Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Dockerize Everything
Search
Thomas Einwaller
May 27, 2015
Technology
3
12k
Dockerize Everything
what is Docker and how can I use it?
Thomas Einwaller
May 27, 2015
Tweet
Share
More Decks by Thomas Einwaller
See All by Thomas Einwaller
Why Slack is not your usual messenger
tompson
0
35k
Dockerize Everything TopConf Tallinn 2015
tompson
0
410
What the Version?
tompson
0
54
Why Podcasts are awesome
tompson
0
2.7k
Other Decks in Technology
See All in Technology
Amazon SageMaker Unified Studio(Preview)、Lakehouse と Amazon S3 Tables
ishikawa_satoru
0
150
AWS re:Invent 2024で発表された コードを書く開発者向け機能について
maruto
0
190
Qiita埋め込み用スライド
naoki_0531
0
2.4k
KnowledgeBaseDocuments APIでベクトルインデックス管理を自動化する
iidaxs
1
260
サイバー攻撃を想定したセキュリティガイドライン 策定とASM及びCNAPPの活用方法
syoshie
3
1.2k
kargoの魅力について伝える
magisystem0408
0
200
あの日俺達が夢見たサーバレスアーキテクチャ/the-serverless-architecture-we-dreamed-of
tomoki10
0
430
Snykで始めるセキュリティ担当者とSREと開発者が楽になる脆弱性対応 / Getting started with Snyk Vulnerability Response
yamaguchitk333
2
180
小学3年生夏休みの自由研究「夏休みに Copilot で遊んでみた」
taichinakamura
0
150
開発生産性向上! 育成を「改善」と捉えるエンジニア育成戦略
shoota
1
300
フロントエンド設計にモブ設計を導入してみた / 20241212_cloudsign_TechFrontMeetup
bengo4com
0
1.9k
OpenAIの蒸留機能(Model Distillation)を使用して運用中のLLMのコストを削減する取り組み
pharma_x_tech
4
550
Featured
See All Featured
Rails Girls Zürich Keynote
gr2m
94
13k
Product Roadmaps are Hard
iamctodd
PRO
49
11k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
5
440
Designing for humans not robots
tammielis
250
25k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
29
2k
Art, The Web, and Tiny UX
lynnandtonic
298
20k
Faster Mobile Websites
deanohume
305
30k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
127
18k
Documentation Writing (for coders)
carmenintech
66
4.5k
How STYLIGHT went responsive
nonsquared
95
5.2k
Thoughts on Productivity
jonyablonski
67
4.4k
Imperfection Machines: The Place of Print at Facebook
scottboms
266
13k
Transcript
Dockerize Everything Thomas Einwaller, troii Software
2008 2013
None
None
None
None
None
Number of Processes ~$ ps ax | wc -l 283
~$ docker run ubuntu ps ax PID TTY STAT TIME COMMAND 1 ? Rs 0:00 ps ax
None
code runtime libraries OS container what is in a container?
ubuntu nginx java tomcat App A App B wordpress website
X “inheritance”
one process per container tomcat mysql war, .properties link container
A container B
immutable
ship the whole environment
How to get started?
Kitematic
None
None
None
Search and Run an Image ~$ docker search -s 10
wordpress NAME DESCRIPTION STARS OFFICIAL wordpress The WordPress rich content management syst... 323 [OK] tutum/wordpress Wordpress Docker image - listens in port 8... 40 ... ~$ docker run wordpress Unable to find image 'wordpress:latest' locally latest: Pulling from wordpress 60fa28093d2e: Pull complete a8f83d6d9aa9: Pull complete d0ca8f539db8: Pull complete ...
How to build my own?
Custom Container ~$ docker run -it ubuntu /bin/bash root:/# root:/#
apt-get install -y mysql-server Reading package lists... Done Building dependency tree Reading state information... Done …
Commit Container ~$ docker ps CONTAINER ID IMAGE COMMAND NAMES
e5a0e59fd3fd ubuntu:latest "/bin/bash" prickly_nobel ~$ docker commit prickly_nobel tom/mysql CONTAINER ID IMAGE COMMAND NAMES e5a0e59fd3fd ubuntu:latest "/bin/bash" prickly_nobel ~$ docker images REPOSITORY TAG IMAGE ID VIRTUAL SIZE tom/mysql latest 86a1fcd53530 512.1 MB ~$ docker run tom/mysql ...
Dockerfile FROM ubuntu MAINTAINER Thomas Einwaller,
[email protected]
RUN apt-get update
&& apt-get -y install apache2 ENV APACHE_RUN_USER www-data ENV APACHE_RUN_GROUP www-data ENV APACHE_LOG_DIR /var/log/apache2 ENV APACHE_LOCK_DIR /var/lock/apache2 ENV APACHE_PID_FILE /var/run/apache2.pid RUN mkdir /var/lock/apache2 EXPOSE 80 CMD ["/usr/sbin/apache2", "-D", "FOREGROUND"]
Docker build ~$ docker build -t tom/apache2 . Sending build
context to Docker daemon 2.048 kB Sending build context to Docker daemon Step 0 : FROM ubuntu ---> bdb87369f343 Step 1 : MAINTAINER Thomas Einwaller,
[email protected]
---> Using cache ---> adcf06d4a78f Step 2 : RUN apt-get update && apt-get -y install apache2 ---> Using cache ---> 5aee61ee1c84 ... Step 9 : EXPOSE 80 ---> Using cache ---> ac985c02bfd6 Step 10 : CMD /usr/sbin/apache2 -D FOREGROUND ---> Running in 0a822e00e190 ---> 89ac6eef066c Successfully built 89ac6eef066c
Docker history ~$ docker history tom/apache2 IMAGE CREATED CREATED BY
SIZE a6b064aec848 2 minutes ago /bin/sh -c #(nop) CMD ["/usr/sbin/apache2" "- 0 B dc0e02dc4d11 2 minutes ago /bin/sh -c #(nop) EXPOSE 80/tcp 0 B 1bc593d23431 2 minutes ago /bin/sh -c mkdir /var/lock/apache2 0 B afdda46774c6 2 minutes ago /bin/sh -c #(nop) ENV APACHE_PID_FILE=/var/ru 0 B 7f1a112bfd2e 2 minutes ago /bin/sh -c #(nop) ENV APACHE_LOCK_DIR=/var/lo 0 B 8a95fc52c646 2 minutes ago /bin/sh -c #(nop) ENV APACHE_LOG_DIR=/var/log 0 Ba32a610ccb8 2 minutes ago /bin/sh -c #(nop) ENV APACHE_RUN_GROUP=www-da 0 B 8083f7e42d6d 2 minutes ago /bin/sh -c #(nop) ENV APACHE_RUN_USER=www-dat 0 B 8cbd4df21d8b 2 minutes ago /bin/sh -c apt-get update && apt-get -y insta 30.63 MB ddfbce728239 2 minutes ago /bin/sh -c #(nop) MAINTAINER Thomas Einwaller 0 B bdb87369f343 5 weeks ago /bin/sh -c #(nop) CMD [/bin/zsh] 0 B ....
Docker push ~$ docker push tom/apache2 Sending image list Pushing
repository tom/apache2 (1 tags) Image 511136ea3c5a already pushed, skipping Image 9fec74352904 already pushed, skipping Image d0955f21bf24 already pushed, skipping ... and pull ~$ docker pull tom/apache2 Unable to find image 'tom/apache2:latest' locally latest: Pulling from tom/apache2 60fa28093d2e: Pull complete a8f83d6d9aa9: Pull complete d0ca8f539db8: Pull complete ...
How to use it?
git repository artifact repository Development Environment Continuous Integration Source Artifact
(.war, .jar, ...) Test/Prod Environment build / deployment pipeline before docker
build / deployment pipeline with docker git repository artifact repository
docker repository Development Environment Continuous Integration Source Artifact (.war, .jar, ...) Continuous Integration Test/Prod Environment Docker Image
Development Environment ~$ docker run -v /Users/tom/website:/website nginx … ~$
docker run -v /Users/tom/code:/code node …
or
Backup Tools ~$ docker run --volumes-from=nexus_data -e SOURCE=/usr/local/sonatype-work -e TARGET=s3://s3-eu-west-1.amazonaws.com/nexus-backup/
-e TARGET_USER=$AWSACCESSKEYID -e TARGET_PASS=$AWSSECRETACCESSKEY duply ~$ docker run --link mysql:db -e BUCKET_NAME=mysql-backup -e AWSACCESSKEYID=$AWSACCESSKEYID -e AWSSECRETACCESSKEY=$AWSSECRETACCESSKEY -e DBNAMES=test -e USERNAME=user -e PASSWORD=password automysqlbackup
Backup Tools ~$ docker run -v /home/tom/development/src:/src groovy //.gvm/groovy/ current/bin/groovy
/src/script.groovy ~$
dexec
Docker machine ~$ docker-machine create --driver virtualbox dev INFO[0001] Downloading
boot2docker.iso to /home/tom/.docker/machine/ INFO[0011] Creating SSH key... INFO[0012] Creating VirtualBox VM... INFO[0019] Starting VirtualBox VM... ... ~$ docker-machine ls NAME ACTIVE DRIVER STATE URL dev * virtualbox Running tcp://192.168.99.103:2376 staging digitalocean Running tcp://104.236.50.118:2376
Docker compose web: build: . links: - db ports: -
"8000:8000" db: image: postgres
docker swarm
None