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
990
Git et la théorie des graph
ubermuda
3
970
Introduction à Docker
ubermuda
6
980
A multi-container Symfony2 setup with Docker
ubermuda
40
12k
Docker Introduction
ubermuda
5
430
Symfony 2, un framework robuste et moderne
ubermuda
5
170
Migration d'une base de code subversion vers git
ubermuda
0
85
Other Decks in Technology
See All in Technology
株式会社ログラス − エンジニア向け会社説明資料 / Loglass Comapany Deck for Engineer
loglass2019
3
31k
Wvlet: A New Flow-Style Query Language For Functional Data Modeling and Interactive Data Analysis - Trino Summit 2024
xerial
1
110
生成AIのガバナンスの全体像と現実解
fnifni
1
180
Oracle Cloud Infrastructure:2024年12月度サービス・アップデート
oracle4engineer
PRO
0
160
[Ruby] Develop a Morse Code Learning Gem & Beep from Strings
oguressive
1
150
DevOps視点でAWS re:invent2024の新サービス・アプデを振り返ってみた
oshanqq
0
180
How to be an AWS Community Builder | 君もAWS Community Builderになろう!〜2024 冬 CB募集直前対策編?!〜
coosuke
PRO
2
2.8k
2024年にチャレンジしたことを振り返るぞ
mitchan
0
130
KubeCon NA 2024 Recap: How to Move from Ingress to Gateway API with Minimal Hassle
ysakotch
0
200
統計データで2024年の クラウド・インフラ動向を眺める
ysknsid25
2
830
コンテナセキュリティのためのLandlock入門
nullpo_head
2
320
NilAway による静的解析で「10 億ドル」を節約する #kyotogo / Kyoto Go 56th
ytaka23
3
370
Featured
See All Featured
Mobile First: as difficult as doing things right
swwweet
222
9k
Unsuck your backbone
ammeep
669
57k
BBQ
matthewcrist
85
9.4k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
95
17k
Optimising Largest Contentful Paint
csswizardry
33
3k
YesSQL, Process and Tooling at Scale
rocio
169
14k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
170
For a Future-Friendly Web
brad_frost
175
9.4k
Product Roadmaps are Hard
iamctodd
PRO
49
11k
How To Stay Up To Date on Web Technology
chriscoyier
789
250k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
28
900
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