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
190
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
360
Comment Docker révolutionne le web
ubermuda
3
660
Vers des applications twelve-factor
ubermuda
2
970
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
82
Other Decks in Technology
See All in Technology
失敗しないOpenJDKの非互換調査
tabatad
0
260
Commitment vs Harrisonism - Keynote for Scrum Niseko 2024
miholovesq
6
1k
よくわからんサービスについての問い合わせが来たときの強い味方 Amazon Q について
kazzpapa3
0
220
君は隠しイベントを見つけれるか?
mujyun
0
260
いまならこう作りたい AWSコンテナ[本格]入門ハンズオン 〜2024年版 ハンズオンの構想〜
horsewin
9
2k
Jr. Championsになって、強く連携しながらAWSをもっと使いたい!~AWSに対する期待と行動~
amixedcolor
0
180
新卒1年目が向き合う生成AI事業の開発を加速させる技術選定 / ai-web-launcher
cyberagentdevelopers
PRO
7
1.5k
IaC運用を楽にするためにCDK Pipelinesを導入したけど、思い通りにいかなかった話
smt7174
1
100
ExaDB-D dbaascli で出来ること
oracle4engineer
PRO
0
3.6k
プロダクト成長に対応するプラットフォーム戦略:Authleteによる共通認証基盤の移行事例 / Building an authentication platform using Authlete and AWS
kakehashi
1
150
独自ツール開発でスタジオ撮影をDX!「VLS(Virtual LED Studio)」 / dx-studio-vls
cyberagentdevelopers
PRO
1
170
【若手エンジニア応援LT会】AWSで繋がり、共に成長! ~コミュニティ活動と新人教育への挑戦~
kazushi_ohata
0
170
Featured
See All Featured
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
Imperfection Machines: The Place of Print at Facebook
scottboms
264
13k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
Keith and Marios Guide to Fast Websites
keithpitt
408
22k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
167
49k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
7.9k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
504
140k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
27
1.9k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Designing the Hi-DPI Web
ddemaree
280
34k
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