Slide 1

Slide 1 text

Offizielle Docker Images ein Erfahrungsbericht Philipp Krenn̴̴̴̴@xeraa

Slide 2

Slide 2 text

Infrastructure | Developer

Slide 3

Slide 3 text

Who uses Docker?

Slide 4

Slide 4 text

Who uses Docker in production?

Slide 5

Slide 5 text

Who uses stateful Docker images?

Slide 6

Slide 6 text

Who uses our images?

Slide 7

Slide 7 text

Who uses our stack with other images?

Slide 8

Slide 8 text

Docker: the world's most heavily funded college project Internal quote from Slack

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

Content "Official" Base Images Release Policy Security & Stability Customization Orchestration

Slide 11

Slide 11 text

Docker Hub "official"

Slide 12

Slide 12 text

What do you get? docker pull elasticsearch:X Same for Kibana and Logstash

Slide 13

Slide 13 text

It's Complicated Docker Inc Deprecated Replicated

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

Custom Registry docker.elastic.co

Slide 18

Slide 18 text

I’m surprised more people don’t just host their own container registries since doing that is faster than every cloud offering and docker hub https://twitter.com/jessfraz/status/978449365261082625

Slide 19

Slide 19 text

Our Motivation Download statistics Speed & reliability

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

https://www.docker.elastic.co

Slide 22

Slide 22 text

Problems Some broken tooling like automated builds, Kitematic,... China IPv6

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

https://hub.docker.com/r/elastic/ elasticsearch/ kibana/ *beat/ logstash/ apm-server/

Slide 25

Slide 25 text

Base Images

Slide 26

Slide 26 text

Elasticsearch Alpine

Slide 27

Slide 27 text

Kibana̴Beats̴Logstash Ubuntu

Slide 28

Slide 28 text

Common base image in 5.4+ CentOS 7

Slide 29

Slide 29 text

https://github.com/elastic/elasticsearch-docker/blob/master/templates/Dockerfile.j2 FROM centos:7 AS prep_es_files ENV PATH /usr/share/elasticsearch/bin:$PATH RUN curl -s https://download.java.net/java/GA/jdk11/13/GPL/openjdk-11.0.1_linux-x64_bin.tar.gz | \ tar -C /opt -zxf - ENV JAVA_HOME /opt/jdk-11.0.1 RUN groupadd -g 1000 elasticsearch && \ adduser -u 1000 -g 1000 -d /usr/share/elasticsearch elasticsearch

Slide 30

Slide 30 text

Upside Similar setup Shared layers JVM large anyway

Slide 31

Slide 31 text

No content

Slide 32

Slide 32 text

Downside Size

Slide 33

Slide 33 text

$ docker images REPOSITORY TAG IMAGE ID SIZE docker.elastic.co/kibana/kibana 6.5.0 fcc1f039f61c 727MB docker.elastic.co/elasticsearch/elasticsearch 6.5.0 ff171d17e77c 774MB docker.elastic.co/beats/filebeat 6.5.0 aee067f4a241 299MB docker.elastic.co/kibana/kibana 6.2.4 327c6538ba4c 933MB docker.elastic.co/elasticsearch/elasticsearch 6.2.4 7cb69da7148d 515MB docker.elastic.co/beats/filebeat 6.2.4 26a00abcde82 319MB docker.elastic.co/kibana/kibana 5.6.13 59fcc69d2cc6 653MB docker.elastic.co/elasticsearch/elasticsearch 5.6.13 21673573a265 525MB docker.elastic.co/beats/filebeat 5.6.13 2aec30f6b3fc 284MB docker.elastic.co/kibana/kibana 5.3.3 ffe778f7e489 679MB docker.elastic.co/elasticsearch/elasticsearch 5.3.3 5857f98b5920 165MB docker.elastic.co/beats/filebeat 5.3.3 c01be8a8f630 232MB

Slide 34

Slide 34 text

5.3 5.6 6.2 6.5 ES 165MB 525MB 515MB 774MB Kibana 679MB 653MB 933MB 727MB Filebeat 232MB 284MB 319MB 299MB

Slide 35

Slide 35 text

Does it matter? stateful vs stateless

Slide 36

Slide 36 text

What to include?

Slide 37

Slide 37 text

Single image for 5.x Platinum trial

Slide 38

Slide 38 text

Three flavors 6.0 to 6.2 Basic*, OSS, Platinum trial * Default

Slide 39

Slide 39 text

Two flavors 6.3+ Basic / Platinum trial*, OSS * Default

Slide 40

Slide 40 text

Future

Slide 41

Slide 41 text

Multiple base images?

Slide 42

Slide 42 text

Windows?!

Slide 43

Slide 43 text

Release Policy

Slide 44

Slide 44 text

No :latest

Slide 45

Slide 45 text

Zombies ideas that should have been killed by evidence, but keep shambling along

Slide 46

Slide 46 text

6 and 6.4?

Slide 47

Slide 47 text

What's in a tag? docker.elastic.co/elasticsearch/elasticsearch 5.3.3 5857f98b5920 4 months ago docker.elastic.co/beats/filebeat 5.3.3 c01be8a8f630 5 months ago docker.elastic.co/kibana/kibana 5.3.3 ffe778f7e489 5 months ago

Slide 48

Slide 48 text

Currently Overwrite tag

Slide 49

Slide 49 text

Label Schema LABEL org.label-schema.schema-version="1.0" \ org.label-schema.vendor="Elastic" \ org.label-schema.name="elasticsearch" \ org.label-schema.version="{{ elastic_version }}" \ org.label-schema.url="https://www.elastic.co/products/elasticsearch" \ org.label-schema.vcs-url="https://github.com/elastic/elasticsearch-docker" \ {% if image_flavor == 'oss' -%} license="Apache-2.0" {% else -%} license="Elastic License" {% endif -%}

Slide 50

Slide 50 text

Base image & JVM direct dependencies

Slide 51

Slide 51 text

Future Add image version?

Slide 52

Slide 52 text

Security & Stability

Slide 53

Slide 53 text

Run Elasticsearch as root

Slide 54

Slide 54 text

Cockroaches claims that disappear for a while when proved wrong, but just keep on coming back

Slide 55

Slide 55 text

Mode Production: Clusterable Development: Local network

Slide 56

Slide 56 text

"Docker" mode discovery.type=single-node

Slide 57

Slide 57 text

Bootstrap checks are here to stay

Slide 58

Slide 58 text

6.0+ no more default credentials

Slide 59

Slide 59 text

6.x Security non-trial requires certificates

Slide 60

Slide 60 text

The container runs Elasticsearch as user elasticsearch using uid:gid 1000:1000. https://www.elastic.co/guide/en/elasticsearch/reference/current/ docker.html

Slide 61

Slide 61 text

No content

Slide 62

Slide 62 text

No content

Slide 63

Slide 63 text

No content

Slide 64

Slide 64 text

Don't mutate the bind mounted local directory

Slide 65

Slide 65 text

Those who do not understand Unix are condemned to reinvent it, poorly. — Henry Spencer

Slide 66

Slide 66 text

Docker default value? LimitNOFILE & LimitNPROC

Slide 67

Slide 67 text

infinity https://github.com/moby/moby/commit/ 8db61095a3d0bcb0733580734ba5d54bc27a614d (July 2016)

Slide 68

Slide 68 text

Test $ docker run --rm centos:7 /bin/bash -c \ 'ulimit -Hn && ulimit -Sn && ulimit -Hu && ulimit -Su' 1048576 1048576 unlimited unlimited

Slide 69

Slide 69 text

Limit for virtual memory? vm.max_map_count

Slide 70

Slide 70 text

Test $ docker run --rm centos:7 /bin/bash -c \ 'sysctl vm.max_map_count' vm.max_map_count = 262144 Must be set on the host

Slide 71

Slide 71 text

Combine two new systems to get chaos & despair

Slide 72

Slide 72 text

Docker is a leaky abstraction

Slide 73

Slide 73 text

No content

Slide 74

Slide 74 text

Customization

Slide 75

Slide 75 text

Feature Request if [ -f /custom/user_init.sh ] then . /custom/user_init.sh fi Or customization through environment variables

Slide 76

Slide 76 text

No Runtime Mutation

Slide 77

Slide 77 text

Dockerfile ARG ELASTIC_VERSION FROM docker.elastic.co/elasticsearch/elasticsearch:${ELASTIC_VERSION} RUN bin/elasticsearch-plugin install analysis-phonetic --batch ARG ELASTIC_VERSION RUN bin/elasticsearch-plugin install \ https://github.com/spinscale/elasticsearch-ingest-langdetect/releases/download/ ${ELASTIC_VERSION}.1/ingest-langdetect-${ELASTIC_VERSION}.1.zip --batch

Slide 78

Slide 78 text

Generate Keystore $ docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" \ -v /Users/philipp/Desktop/demo/config/:/usr/share/elasticsearch/config/ \ -it docker.elastic.co/elasticsearch/elasticsearch:6.4.3 /bin/bash [root@1006ed50b646 elasticsearch]# ./bin/elasticsearch-keystore create Created elasticsearch keystore in /usr/share/elasticsearch/config [root@1006ed50b646 elasticsearch]# ./bin/elasticsearch-keystore add test Enter value for test: [root@1006ed50b646 elasticsearch]# exit exit $ cat config/elasticsearch.keystore ??lelasticsearch.keystore?@g?o!?$?K?Lf?w?VAEŠԨm?[?a6?B??? y?,!В}??Ħ?ǣ?AU=?C?:?o? ?W?O8?}U?;p?ӷ???cQ????7?JY? 2A?:???ZUY??2V?9?ϧ??(??0?q\

Slide 79

Slide 79 text

Mount Keystore (Docker Compose) elasticsearch: image: docker.elastic.co/elasticsearch/elasticsearch:${ELASTIC_VERSION} secrets: - source: elasticsearch.keystore target: /usr/share/elasticsearch/config/elasticsearch.keystore

Slide 80

Slide 80 text

Orchestration

Slide 81

Slide 81 text

Who uses Kubernetes?

Slide 82

Slide 82 text

Who uses Swarm?

Slide 83

Slide 83 text

Who uses Mesos?

Slide 84

Slide 84 text

Who uses Nomad?

Slide 85

Slide 85 text

No orchestration yet

Slide 86

Slide 86 text

Kubernetes 1.8 allows dots in env vars https://github.com/kubernetes/kubernetes/issues/2707

Slide 87

Slide 87 text

No content

Slide 88

Slide 88 text

No content

Slide 89

Slide 89 text

Kubernetes has made huge improvements in the ability to run stateful workloads including databases and message queues, but I still prefer not to run them on Kubernetes. https://twitter.com/kelseyhightower/status/963413508300812295

Slide 90

Slide 90 text

No content

Slide 91

Slide 91 text

Conclusion

Slide 92

Slide 92 text

"Docker is disrupting the industry"

Slide 93

Slide 93 text

"Can I run Elasticsearch on Docker?"

Slide 94

Slide 94 text

"Should I run Elasticsearch on Docker?"

Slide 95

Slide 95 text

Even when stateful services do the right things managing state is still hard. Mixing stateful and stateless applications on the same cluster elevates the complexity of the entire cluster. Cluster security and upgrades become much harder. https://twitter.com/kelseyhightower/status/963417215608369153

Slide 96

Slide 96 text

Quick Quiz What do you get?

Slide 97

Slide 97 text

docker pull elastic/elasticsearch

Slide 98

Slide 98 text

$ docker pull elastic/elasticsearch Using default tag: latest Error response from daemon: manifest for elastic/elasticsearch:latest not found

Slide 99

Slide 99 text

docker pull logstash:alpine

Slide 100

Slide 100 text

docker pull metricbeat:6.4.3

Slide 101

Slide 101 text

$ docker pull metricbeat:6.4.3 Error response from daemon: pull access denied for metricbeat, repository does not exist or may require 'docker login'

Slide 102

Slide 102 text

docker pull elastic/metricbeat:6.4.3

Slide 103

Slide 103 text

docker pull docker.elastic.co/apm/apm-server:6.4.3

Slide 104

Slide 104 text

"Aggregierte Logging-Patterns" Tomorrow 15:45 @ Gustav Mahler II

Slide 105

Slide 105 text

Questions & Discussion Philipp Krenn̴̴̴@xeraa