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
86
Other Decks in Technology
See All in Technology
多領域インシデントマネジメントへの挑戦:ハードウェアとソフトウェアの融合が生む課題/Challenge to multidisciplinary incident management: Issues created by the fusion of hardware and software
bitkey
PRO
2
110
新機能VPCリソースエンドポイント機能検証から得られた考察
duelist2020jp
0
230
バクラクのドキュメント解析技術と実データにおける課題 / layerx-ccc-winter-2024
shimacos
2
1.1k
あの日俺達が夢見たサーバレスアーキテクチャ/the-serverless-architecture-we-dreamed-of
tomoki10
0
500
社内イベント管理システムを1週間でAKSからACAに移行した話し
shingo_kawahara
0
190
継続的にアウトカムを生み出し ビジネスにつなげる、 戦略と運営に対するタイミーのQUEST(探求)
zigorou
0
650
OpenAIの蒸留機能(Model Distillation)を使用して運用中のLLMのコストを削減する取り組み
pharma_x_tech
4
570
Amazon Kendra GenAI Index 登場でどう変わる? 評価から学ぶ最適なRAG構成
naoki_0531
0
120
ゼロから創る横断SREチーム 挑戦と進化の軌跡
rvirus0817
2
270
非機能品質を作り込むための実践アーキテクチャ
knih
5
1.5k
20241220_S3 tablesの使い方を検証してみた
handy
4
640
2024年にチャレンジしたことを振り返るぞ
mitchan
0
140
Featured
See All Featured
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
132
33k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Producing Creativity
orderedlist
PRO
341
39k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
32
2.7k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
330
21k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Writing Fast Ruby
sferik
628
61k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
127
18k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
Designing on Purpose - Digital PM Summit 2013
jponch
116
7k
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