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
Meetup Docker 101
Search
ubermuda
May 28, 2014
Technology
1
200
Meetup Docker 101
A gentle introduction to Docker
ubermuda
May 28, 2014
Tweet
Share
More Decks by ubermuda
See All by ubermuda
La théorie des graphes appliquée à Git
ubermuda
0
370
Comment Docker révolutionne le web
ubermuda
3
670
Vers des applications twelve-factor
ubermuda
2
980
Git et la théorie des graph
ubermuda
3
960
Introduction à Docker
ubermuda
6
970
A multi-container Symfony2 setup with Docker
ubermuda
40
12k
Docker Introduction
ubermuda
5
420
Symfony 2, un framework robuste et moderne
ubermuda
5
170
Migration d'une base de code subversion vers git
ubermuda
0
83
Other Decks in Technology
See All in Technology
Can We Measure Developer Productivity?
ewolff
1
150
Lexical Analysis
shigashiyama
1
150
[FOSS4G 2019 Niigata] AIによる効率的危険斜面抽出システムの開発について
nssv
0
310
フルカイテン株式会社 採用資料
fullkaiten
0
40k
VideoMamba: State Space Model for Efficient Video Understanding
chou500
0
190
B2B SaaS × AI機能開発 〜テナント分離のパターン解説〜 / B2B SaaS x AI function development - Explanation of tenant separation pattern
oztick139
2
220
これまでの計測・開発・デプロイ方法全部見せます! / Findy ISUCON 2024-11-14
tohutohu
3
360
適材適所の技術選定 〜GraphQL・REST API・tRPC〜 / Optimal Technology Selection
kakehashi
1
160
The Rise of LLMOps
asei
5
1.2k
RubyのWebアプリケーションを50倍速くする方法 / How to Make a Ruby Web Application 50 Times Faster
hogelog
3
940
[CV勉強会@関東 ECCV2024 読み会] オンラインマッピング x トラッキング MapTracker: Tracking with Strided Memory Fusion for Consistent Vector HD Mapping (Chen+, ECCV24)
abemii
0
220
【Startup CTO of the Year 2024 / Audience Award】アセンド取締役CTO 丹羽健
niwatakeru
0
930
Featured
See All Featured
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
BBQ
matthewcrist
85
9.3k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
364
24k
How To Stay Up To Date on Web Technology
chriscoyier
788
250k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
Done Done
chrislema
181
16k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
44
2.2k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
The Art of Programming - Codeland 2020
erikaheidi
52
13k
Docker and Python
trallard
40
3.1k
Become a Pro
speakerdeck
PRO
25
5k
For a Future-Friendly Web
brad_frost
175
9.4k
Transcript
Docker 101 Geoffrey Bachelet –@ubermuda
Who's talking? • Geoffrey Bachelet • Stage1.io : continuous staging
• Gustave.io : interactive staging • Freelance Developer / Trainer @ubermuda
Container Engine? Based on the Linux kernel's LXC instructions Processes
and resources isolation "chroot" on steroids / super lightweight VMs
Host OS Hypervisor Guest OS Guest OS Guest OS Guest
OS App App App App Host OS Docker + LXC App App App App VMs vs Containers
VMs vs Containers LXC / Jails / Zones / etc
Uses the host's kernel Boots in seconds 0 overhead (almost) Easy to pass around Hypervisor Boots a complete OS Boots in minutes Guest OS' overhead Several Go images
Image vs Container
credit: http:/ /docs.docker.io/en/latest/terms/image/ Image
Container credit: http:/ /docs.docker.io/en/latest/terms/image/
Create a container
$ docker run -‐i -‐t stackbrew/ubuntu /bin/bash ! root@21d86a0b8387:/#
Commit the container
root@21d86a0b8387:/# apt-‐get install nginx root@21d86a0b8387:/# exit ! $
docker ps -‐q -‐n 1 21d86a0b8387 ! $ docker commit 21d86a0b8387 sflive/nginx 240198b750c3cc950c60005d6d24cae4fc2dbcc6c31e274574af68d4a2e8 ! $ docker images REPOSITORY TAG IMAGE ID sflive/nginx latest 240198b750c3
root@21d86a0b8387:/# apt-‐get install nginx root@21d86a0b8387:/# exit ! $
docker ps -‐q -‐n 1 21d86a0b8387 ! $ docker commit 21d86a0b8387 sflive/nginx 240198b750c3cc950c60005d6d24cae4fc2dbcc6c31e274574af68d4a2e8 ! $ docker images REPOSITORY TAG IMAGE ID sflive/nginx latest 240198b750c3
root@21d86a0b8387:/# apt-‐get install nginx root@21d86a0b8387:/# exit ! $
docker ps -‐q -‐n 1 21d86a0b8387 ! $ docker commit 21d86a0b8387 sflive/nginx 240198b750c3cc950c60005d6d24cae4fc2dbcc6c31e274574af68d4a2e8 ! $ docker images REPOSITORY TAG IMAGE ID sflive/nginx latest 240198b750c3
root@21d86a0b8387:/# apt-‐get install nginx root@21d86a0b8387:/# exit ! $
docker ps -‐q -‐n 1 21d86a0b8387 ! $ docker commit 21d86a0b8387 sflive/nginx 240198b750c3cc950c60005d6d24cae4fc2dbcc6c31e274574af68d4a2e8 ! $ docker images REPOSITORY TAG IMAGE ID sflive/nginx latest 240198b750c3
Run the image
$ docker run -‐p 80 sflive/nginx nginx -‐g 'daemon off;'
$ docker run -‐p 80 sflive/nginx nginx -‐g 'daemon off;'
$ docker run -‐p 80 sflive/nginx nginx -‐g 'daemon off;'
$ docker run -‐p 80 sflive/nginx nginx -‐g 'daemon off;'
$ docker run -‐p 80 sflive/nginx nginx -‐g 'daemon off;'
$ docker run -‐p 80 sflive/nginx nginx -‐g 'daemon off;'
$ docker ps CONTAINER ID ... PORTS
923cb190dbc3 ... 0.0.0.0:49155-‐>80/tcp ! $ curl http://localhost:49155 <html> <head> <title>Welcome to nginx!</title> ...
$ docker ps CONTAINER ID ... PORTS
923cb190dbc3 ... 0.0.0.0:49155-‐>80/tcp ! $ curl http://localhost:49155 <html> <head> <title>Welcome to nginx!</title> ...
Dockerfile
credit: http:/ /docs.docker.io/en/latest/terms/image/
FROM stackbrew/ubuntu ENV DEBIAN_FRONTEND noninteractive RUN apt-‐get install
-‐y nginx ADD nginx.conf /etc/nginx/nginx.conf EXPOSE 80 VOLUME ["/var/www"] CMD ["-‐g", "daemon off;"] ENTRYPOINT ["nginx"]
FROM stackbrew/ubuntu ENV DEBIAN_FRONTEND noninteractive RUN apt-‐get install
-‐y nginx ADD nginx.conf /etc/nginx/nginx.conf EXPOSE 80 VOLUME ["/var/www"] CMD ["-‐g", "daemon off;"] ENTRYPOINT ["nginx"]
FROM stackbrew/ubuntu ENV DEBIAN_FRONTEND noninteractive RUN apt-‐get install
-‐y nginx ADD nginx.conf /etc/nginx/nginx.conf EXPOSE 80 VOLUME ["/var/www"] CMD ["-‐g", "daemon off;"] ENTRYPOINT ["nginx"]
FROM stackbrew/ubuntu ENV DEBIAN_FRONTEND noninteractive RUN apt-‐get install
-‐y nginx ADD nginx.conf /etc/nginx/nginx.conf EXPOSE 80 VOLUME ["/var/www"] CMD ["-‐g", "daemon off;"] ENTRYPOINT ["nginx"]
FROM stackbrew/ubuntu ENV DEBIAN_FRONTEND noninteractive RUN apt-‐get install
-‐y nginx ADD nginx.conf /etc/nginx/nginx.conf EXPOSE 80 VOLUME ["/var/www"] CMD ["-‐g", "daemon off;"] ENTRYPOINT ["nginx"]
FROM stackbrew/ubuntu ENV DEBIAN_FRONTEND noninteractive RUN apt-‐get install
-‐y nginx ADD nginx.conf /etc/nginx/nginx.conf EXPOSE 80 VOLUME ["/var/www"] CMD ["-‐g", "daemon off;"] ENTRYPOINT ["nginx"]
FROM stackbrew/ubuntu ENV DEBIAN_FRONTEND noninteractive RUN apt-‐get install
-‐y nginx ADD nginx.conf /etc/nginx/nginx.conf EXPOSE 80 VOLUME ["/var/www"] CMD ["-‐g", "daemon off;"] ENTRYPOINT ["nginx"]
FROM stackbrew/ubuntu ENV DEBIAN_FRONTEND noninteractive RUN apt-‐get install
-‐y nginx ADD nginx.conf /etc/nginx/nginx.conf EXPOSE 80 VOLUME ["/var/www"] CMD ["-‐g", "daemon off;"] ENTRYPOINT ["nginx"]
FROM stackbrew/ubuntu ENV DEBIAN_FRONTEND noninteractive RUN apt-‐get install
-‐y nginx ADD nginx.conf /etc/nginx/nginx.conf EXPOSE 80 VOLUME ["/var/www"] CMD ["-‐g", "daemon off;"] ENTRYPOINT ["nginx"]
Features
• Docker CLI • run -d, attach, wait, ps, images,
rm, rmi, etc • Networking • Ambassador, advanced routing, etc • Volumes • Data containers, bindmounting, etc • Docker Index • thousands of ready-made images • Docker Registry • private Docker Index • Remote API • dockerode, Docker-PHP, etc
Docker CLI • run [-‐d] : execute a container •
attach : attach stdout • ps : list running containers • images : list existing images • rm / rmi : delete containers / images
Networking Link containers together Easy service discovery Ambassador pattern (service
portability)
Volumes Like NFS for docker (except it works) Store data
in data containers Easily backup data containers
Docker Index + Registry Thousands of ready-made images Private registry
Docker Remote API Rest(-ish) HTTP API for Docker ! Third
party client libraries: dockerode, Docker-php, etc
Orchestration
Host OS THE INTERNET container nginx mysql php5-fpm
Host OS THE INTERNET nginx mysql php5-fpm /var/www /var/lib/mysql
Not built-in Lots of third-party tools ! maestro-ng, Fig, Gaudi,
etc.
Pets vs Cattle
Use cases
Dev. environments Continuous integration Continuous deployment 0 downtime deployment Private
PaaS
Thanks! https://speackerdeck.com/ubermuda/meetup-docker-101 Geoffrey Bachelet – @ubermuda