SlideShare a Scribd company logo
Docker, c'est bonheur
Qui je suis
● Alexandre Salomé, développeur (180 mois)
● Consultant technique chez SensioLabs (66 mois)
● En mission chez Auchan e-commerce France (7 mois)
– Environnement totalement dockerisé
– Bientôt les serveurs de qualification
– Dans 3 ans en production ?
Docker et vous ?
Sommaire
● Présentation
● Utilisation
– Dockerfile
– Commandes usuelles
– Registry
– Volumes
– Port mapping
– Links
● Outils
– Fig
– Baseimage
– Boot2Docker
– Flynn
Présentation de Docker
Les grandes idées
Docker, c'est bonheur !
Avantages
● Exécution rapide, isolée et transportable
● Mise en commun des ressources
Docker, c'est bonheur !
Show time !
La différence du dossier /etc entre :
- Ubuntu 14.10
- Ubuntu 12.10
docker run ubuntu:14.10 ls /etc > etc-14.10
docker run ubuntu:12.10 ls /etc > etc-12.10
meld etc-14.10 etc-12.10
Utilisation
Commandes usuelles
Commandes usuelles
$ docker run --name=mon_redis redis
Donner un nom à son conteneur avec --name :
docker run redis
docker run ubuntu:14.10 ls /etc
Commandes usuelles
$ docker ps
CONTAINER ID IMAGE CREATED STATUS NAMES
eb232dde2f79 redis:latest 3 seconds ago Up 2 seconds mon_redis
$ docker ps -a
CONTAINER ID IMAGE CREATED STATUS PORTS NAMES
eb232dde2f79 redis:latest 2 minutes ago Up 2 minutes 6379/tcp mon_redis
b715035816d7 redis:latest 4 minutes ago Exited (0) 4 minutes ago sharp_wozniak
Commandes usuelles
$ docker logs mon_redis
[1] 14 Jan 19:35:02.096 # Warning: no config file specified, using the
default config. In order to specify a config file use redis-server
/path/to/redis.conf
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 2.8.17 (00000000/0) 64 bit
.-`` .-```. ```/ _.,_ ''-._
( ' , .-` | `, ) Running in stand alone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 1
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
Commandes usuelles
$ docker inspect mon_redis
# ...
"Created": "2015-01-14T19:35:01.710341398Z",
"Id": "eb232dde2f79741d01d3259566bae6150e5846b3e2e9208a9e6e0897084a80c4",
"Image": "3ce54e911389a2b08207b0a4d01c3131ce01b617ecc1c248f6d81ffdbebd628d",
"State": {
"ExitCode": 0,
"FinishedAt": "0001-01-01T00:00:00Z",
"Paused": false,
"Pid": 4362,
"Restarting": false,
"Running": true,
"StartedAt": "2015-01-14T19:35:02.053470372Z"
# ...
$ docker inspect
-f="{{ .NetworkSettings.IPAddress }}"
mon_redis
172.17.0.3
Commandes usuelles
$ docker diff mon_redis
A /tmp/sess_b86hok0pfj23a81ea3flr0rk03
C /tmp/sess_esmblquiab21m995q2d195j1r5
D /tmp/sess_gl0cmpknk3rirc3l0jmjfd1bo1
C /tmp/sess_ql581nl6ac0uhaj47cftn8ipb7
Afficher le différentiel d'un conteneur :
Commandes usuelles
$ docker run -d --name=mon_redis redis
$ docker stop mon_redis
Démarrer en arrière plan avec -d :
Arrêter un conteneur :
Commandes usuelles
$ docker exec mon_redis ls /etc
Exécuter une commande dans un conteneur démarré :
Commandes usuelles
$ docker rmi redis
Supprimer une image
$ docker rm mon_redis
Supprimer un conteneur
$ docker stop mon_redis
Arrêter un conteneur
$ docker
Commands:
attach Attach to a running container
build Build an image from a Dockerfile
commit Create a new image from a container's changes
cp Copy files/folders from a container's filesystem to the host path
diff Inspect changes on a container's filesystem
events Get real time events from the server
export Stream the contents of a container as a tar archive
history Show the history of an image
images List images
import Create a new filesystem image from the contents of a tarball
info Display system-wide information
inspect Return low-level information on a container
kill Kill a running container
load Load an image from a tar archive
login Register or log in to a Docker registry server
logout Log out from a Docker registry server
logs Fetch the logs of a container
port Lookup the public-facing port that is NAT-ed to PRIVATE_PORT
pause Pause all processes within a container
ps List containers
pull Pull an image or a repository from a Docker registry server
push Push an image or a repository to a Docker registry server
restart Restart a running container
rm Remove one or more containers
rmi Remove one or more images
run Run a command in a new container
save Save an image to a tar archive
search Search for an image on the Docker Hub
start Start a stopped container
stop Stop a running container
tag Tag an image into a repository
top Lookup the running processes of a container
unpause Unpause a paused container
version Show the Docker version information
wait Block until a container stops, then print its exit code
Utilisation
Dockerfile
Dockerfile
● Recette de construction d'un conteneur
● Format de fichier simple
FROM ubuntu:14.10
ENV APACHE_LOG_DIR /var/log/apache2
RUN apt-get install -y apache2
ADD site.conf /path/to/site.conf
EXPOSE 80
CMD ["/usr/sbin/apache2", "-D", "FOREGROUND"]
Exemple non fonctionnel, parce que Apache, c'est pas aussi simple
Dans cet exemple, le Dockerfile fait 5 lignes
Image
Image
Dockerfile
FROM ubuntu:14.10
[...]
[...]
[...]
Image
Image
Conteneur
Conteneur
Conteneur
Dockerfile
$ vi Dockerfile
$ docker run alex/apache
$ docker build --name=alex/apache .
Step 0 : FROM ubuntu:14.10
---> 75204fdb260b
Step 1 : RUN apt-get install apache2
---> Running in 68992170d55d
Reading package lists...
Building dependency tree...
Reading state information...
Step 2 : ...
---> Running in 68992170d55d
...
Dockerfile
FROM phusion/baseimage:0.9.13
ENV HOME /root
EXPOSE 80
EXPOSE 22
CMD /sbin/my_init
RUN apt-get update
RUN apt-get install -y 
git curl 
postgresql 
php5-cli php5-fpm php5-intl php5-mcrypt php5-json php5-pgsql php5-curl 
redis-server 
openjdk-7-jre 
nginx
# Setup elasticsearch
RUN 
cd /tmp && 
curl -o /tmp/elasticsearch-1.3.2.tar.gz
https://download.elasticsearch.org/elasticsearch/elasticsearch/elasti
csearch-1.3.2.tar.gz && 
tar xvzf elasticsearch-1.3.2.tar.gz && 
rm -f elasticsearch-1.3.2.tar.gz && 
mv /tmp/elasticsearch-1.3.2 /elasticsearch
# Setup postgresql
RUN /etc/init.d/postgresql start &&
sudo -u postgres psql --command "CREATE USER
gitonomy WITH SUPERUSER PASSWORD 'gitonomy';" &&
sudo -u postgres createdb -O gitonomy gitonomy
RUN echo "host all all 0.0.0.0/0 md5" >>
/etc/postgresql/9.3/main/pg_hba.conf
RUN echo "listen_addresses='*'" >>
/etc/postgresql/9.3/main/postgresql.conf
# Node stuff
RUN curl -sL https://deb.nodesource.com/setup | bash -
RUN apt-get install -y nodejs
RUN npm install -g bower grunt-cli# composer
RUN curl -o /tmp/composer
http://getcomposer.org/composer.phar; mv /tmp/composer
/usr/bin/composer; chmod a+x /usr/bin/composer
ADD config/nginx.conf /etc/nginx/nginx.conf
ADD config/php-fpm.conf
/etc/php5/fpm/pool.d/www.conf
ADD service/nginx.sh /etc/service/nginx/run
ADD service/php-fpm.sh /etc/service/php-fpm/run
ADD service/postgresql.sh
/etc/service/postgresql/run
ADD service/elasticsearch.sh
/etc/service/elasticsearch/run
ADD service/redis.sh /etc/service/redis/run
ADD startup.sh /etc/my_init.d/gitonomy
Dans la vraie vie, les Dockerfile font 200 lignes
Utilisation
Registry
Docker Registry
Client (vous) Registry
PUSH
PULL
Intégration continue
PUSH
Sourcecode
PUSH
Stocker les images pour éviter les constructions
Registry
$ docker tag alex/apache registry.acme.org/alex/apache
$ docker push registry.acme.org/alex/apache
Volumes
● Permet de partager des dossiers entre
les conteneurs et le système hôte
$ docker run 
-v /home/alex/public:/var/www
my_apache
Le chemin sur mon système Le chemin dans le conteneur
Port mapping
● Permet d'exposer des ports du conteneur sur
l'hôte
$ docker run 
-p 8000:80
my_apache
Le port sur mon système Le port dans le conteneur
Links
$ docker run 
--link mon_redis:mon_redis
ubuntu
env
MON_REDIS_PORT=tcp://172.17.0.2:6379
MON_REDIS_PORT_6379_TCP=tcp://172.17.0.2:6379
MON_REDIS_PORT_6379_TCP_ADDR=172.17.0.2
MON_REDIS_PORT_6379_TCP_PORT=6379
MON_REDIS_PORT_6379_TCP_PROTO=tcp
Résumé des fonctionnalités
docker run
-v /home/alex/public:/var/www
-p 8000:80
--link project_db
--name project_web
my_apache
docker run --name=project_db my_mysql
Outils
fig
web:
build: .
links:
- db
volumes:
- /var/www:/var/www
ports:
- "8000:8000"
db:
image: postgres
$ fig up web
$ docker build --name=web .
$ docker run -p 8000:8000 -v /var/www:/var/www
--link db web
phusion/baseimage
● Framework pour conteneurs Docker
● Multi-process assumé
boot2docker
● Pour les utilisateurs Mac
● Bon courage, surtout pour les volumes
Macintosh
VirtualBox
Linux
Docker
Mais aussi…
● Flynn : automatisation des déploiements
● Shipyard : Docker management
● Mesos & Marathon : Scale
● Gaudi : fig + UI
● Panamax : gestionnaire de conteneurs
En conclusion
● Isolez vos projets de votre système
● Versionnez vos Dockerfile
● Automatisez la construction de vos projets

More Related Content

What's hot

Configuration Surgery with Augeas
Configuration Surgery with AugeasConfiguration Surgery with Augeas
Configuration Surgery with Augeas
Puppet
 
Docker command
Docker commandDocker command
Docker command
Eric Ahn
 
Running Docker in Development & Production (DevSum 2015)
Running Docker in Development & Production (DevSum 2015)Running Docker in Development & Production (DevSum 2015)
Running Docker in Development & Production (DevSum 2015)
Ben Hall
 
DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)
Soshi Nemoto
 
DevOps(2) : Vagrant - (MOSG)
DevOps(2) : Vagrant  -  (MOSG)DevOps(2) : Vagrant  -  (MOSG)
DevOps(2) : Vagrant - (MOSG)
Soshi Nemoto
 
Docker remote-api
Docker remote-apiDocker remote-api
Docker remote-api
Eric Ahn
 
Real World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and ProductionReal World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and Production
Ben Hall
 
Instruction: dev environment
Instruction: dev environmentInstruction: dev environment
Instruction: dev environment
Soshi Nemoto
 
#OktoCampus - Workshop : An introduction to Ansible
#OktoCampus - Workshop : An introduction to Ansible#OktoCampus - Workshop : An introduction to Ansible
#OktoCampus - Workshop : An introduction to Ansible
Cédric Delgehier
 
Docker perl build
Docker perl buildDocker perl build
Docker perl build
Workhorse Computing
 
Learn basic ansible using docker
Learn basic ansible using dockerLearn basic ansible using docker
Learn basic ansible using docker
Larry Cai
 
IT Automation with Ansible
IT Automation with AnsibleIT Automation with Ansible
IT Automation with Ansible
Rayed Alrashed
 
Ansible 實戰:top down 觀點
Ansible 實戰:top down 觀點Ansible 實戰:top down 觀點
Ansible 實戰:top down 觀點
William Yeh
 
Docker - from development to production (PHPNW 2017-09-05)
Docker - from development to production (PHPNW 2017-09-05)Docker - from development to production (PHPNW 2017-09-05)
Docker - from development to production (PHPNW 2017-09-05)
Toby Griffiths
 
From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012
Carlos Sanchez
 
Cialug August 2021
Cialug August 2021Cialug August 2021
Cialug August 2021
Andrew Denner
 
How to Develop Puppet Modules: From Source to the Forge With Zero Clicks
How to Develop Puppet Modules: From Source to the Forge With Zero ClicksHow to Develop Puppet Modules: From Source to the Forge With Zero Clicks
How to Develop Puppet Modules: From Source to the Forge With Zero Clicks
Carlos Sanchez
 
Ansible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife OrchestrationAnsible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife Orchestration
bcoca
 
Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)
Michele Orselli
 
Ansible - Introduction
Ansible - IntroductionAnsible - Introduction
Ansible - Introduction
Stephane Manciot
 

What's hot (20)

Configuration Surgery with Augeas
Configuration Surgery with AugeasConfiguration Surgery with Augeas
Configuration Surgery with Augeas
 
Docker command
Docker commandDocker command
Docker command
 
Running Docker in Development & Production (DevSum 2015)
Running Docker in Development & Production (DevSum 2015)Running Docker in Development & Production (DevSum 2015)
Running Docker in Development & Production (DevSum 2015)
 
DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)
 
DevOps(2) : Vagrant - (MOSG)
DevOps(2) : Vagrant  -  (MOSG)DevOps(2) : Vagrant  -  (MOSG)
DevOps(2) : Vagrant - (MOSG)
 
Docker remote-api
Docker remote-apiDocker remote-api
Docker remote-api
 
Real World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and ProductionReal World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and Production
 
Instruction: dev environment
Instruction: dev environmentInstruction: dev environment
Instruction: dev environment
 
#OktoCampus - Workshop : An introduction to Ansible
#OktoCampus - Workshop : An introduction to Ansible#OktoCampus - Workshop : An introduction to Ansible
#OktoCampus - Workshop : An introduction to Ansible
 
Docker perl build
Docker perl buildDocker perl build
Docker perl build
 
Learn basic ansible using docker
Learn basic ansible using dockerLearn basic ansible using docker
Learn basic ansible using docker
 
IT Automation with Ansible
IT Automation with AnsibleIT Automation with Ansible
IT Automation with Ansible
 
Ansible 實戰:top down 觀點
Ansible 實戰:top down 觀點Ansible 實戰:top down 觀點
Ansible 實戰:top down 觀點
 
Docker - from development to production (PHPNW 2017-09-05)
Docker - from development to production (PHPNW 2017-09-05)Docker - from development to production (PHPNW 2017-09-05)
Docker - from development to production (PHPNW 2017-09-05)
 
From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012
 
Cialug August 2021
Cialug August 2021Cialug August 2021
Cialug August 2021
 
How to Develop Puppet Modules: From Source to the Forge With Zero Clicks
How to Develop Puppet Modules: From Source to the Forge With Zero ClicksHow to Develop Puppet Modules: From Source to the Forge With Zero Clicks
How to Develop Puppet Modules: From Source to the Forge With Zero Clicks
 
Ansible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife OrchestrationAnsible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife Orchestration
 
Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)
 
Ansible - Introduction
Ansible - IntroductionAnsible - Introduction
Ansible - Introduction
 

Similar to Docker, c'est bonheur !

Hands-On Session Docker
Hands-On Session DockerHands-On Session Docker
Hands-On Session Docker
LinetsChile
 
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
Leo Lorieri
 
Puppet Camp Chicago 2014: Docker and Puppet: 1+1=3 (Intermediate)
Puppet Camp Chicago 2014: Docker and Puppet: 1+1=3 (Intermediate)Puppet Camp Chicago 2014: Docker and Puppet: 1+1=3 (Intermediate)
Puppet Camp Chicago 2014: Docker and Puppet: 1+1=3 (Intermediate)
Puppet
 
Start tracking your ruby infrastructure
Start tracking your ruby infrastructureStart tracking your ruby infrastructure
Start tracking your ruby infrastructure
Sergiy Kukunin
 
Docker workshop
Docker workshopDocker workshop
Docker workshop
Evans Ye
 
Docker Security workshop slides
Docker Security workshop slidesDocker Security workshop slides
Docker Security workshop slides
Docker, Inc.
 
Docker Introduction.pdf
Docker Introduction.pdfDocker Introduction.pdf
Docker Introduction.pdf
OKLABS
 
Docker by Example - Basics
Docker by Example - Basics Docker by Example - Basics
Docker by Example - Basics
CodeOps Technologies LLP
 
How to create your own hack environment
How to create your own hack environmentHow to create your own hack environment
How to create your own hack environment
Sumedt Jitpukdebodin
 
Docker in Action
Docker in ActionDocker in Action
Docker in Action
Alper Kanat
 
PDXPortland - Dockerize Django
PDXPortland - Dockerize DjangoPDXPortland - Dockerize Django
PDXPortland - Dockerize Django
Hannes Hapke
 
Docker for mere mortals
Docker for mere mortalsDocker for mere mortals
Docker for mere mortals
Henryk Konsek
 
Wordpress y Docker, de desarrollo a produccion
Wordpress y Docker, de desarrollo a produccionWordpress y Docker, de desarrollo a produccion
Wordpress y Docker, de desarrollo a produccion
Sysdig
 
手把手帶你學Docker 03042017
手把手帶你學Docker 03042017手把手帶你學Docker 03042017
手把手帶你學Docker 03042017
Paul Chao
 
Dockerizing a Symfony2 application
Dockerizing a Symfony2 applicationDockerizing a Symfony2 application
Dockerizing a Symfony2 application
Roman Rodomansky
 
Docker Introductory workshop
Docker Introductory workshopDocker Introductory workshop
Docker Introductory workshop
Runcy Oommen
 
Introduction to Docker - Learning containerization XP conference 2016
Introduction to Docker - Learning containerization  XP conference 2016Introduction to Docker - Learning containerization  XP conference 2016
Introduction to Docker - Learning containerization XP conference 2016
XP Conference India
 
A to Z of a Multi-platform Docker Swarm: Building, Shipping, and Running Mult...
A to Z of a Multi-platform Docker Swarm: Building, Shipping, and Running Mult...A to Z of a Multi-platform Docker Swarm: Building, Shipping, and Running Mult...
A to Z of a Multi-platform Docker Swarm: Building, Shipping, and Running Mult...
Christy Norman
 
From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...
From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...
From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...
Docker, Inc.
 
Docker
DockerDocker

Similar to Docker, c'est bonheur ! (20)

Hands-On Session Docker
Hands-On Session DockerHands-On Session Docker
Hands-On Session Docker
 
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
 
Puppet Camp Chicago 2014: Docker and Puppet: 1+1=3 (Intermediate)
Puppet Camp Chicago 2014: Docker and Puppet: 1+1=3 (Intermediate)Puppet Camp Chicago 2014: Docker and Puppet: 1+1=3 (Intermediate)
Puppet Camp Chicago 2014: Docker and Puppet: 1+1=3 (Intermediate)
 
Start tracking your ruby infrastructure
Start tracking your ruby infrastructureStart tracking your ruby infrastructure
Start tracking your ruby infrastructure
 
Docker workshop
Docker workshopDocker workshop
Docker workshop
 
Docker Security workshop slides
Docker Security workshop slidesDocker Security workshop slides
Docker Security workshop slides
 
Docker Introduction.pdf
Docker Introduction.pdfDocker Introduction.pdf
Docker Introduction.pdf
 
Docker by Example - Basics
Docker by Example - Basics Docker by Example - Basics
Docker by Example - Basics
 
How to create your own hack environment
How to create your own hack environmentHow to create your own hack environment
How to create your own hack environment
 
Docker in Action
Docker in ActionDocker in Action
Docker in Action
 
PDXPortland - Dockerize Django
PDXPortland - Dockerize DjangoPDXPortland - Dockerize Django
PDXPortland - Dockerize Django
 
Docker for mere mortals
Docker for mere mortalsDocker for mere mortals
Docker for mere mortals
 
Wordpress y Docker, de desarrollo a produccion
Wordpress y Docker, de desarrollo a produccionWordpress y Docker, de desarrollo a produccion
Wordpress y Docker, de desarrollo a produccion
 
手把手帶你學Docker 03042017
手把手帶你學Docker 03042017手把手帶你學Docker 03042017
手把手帶你學Docker 03042017
 
Dockerizing a Symfony2 application
Dockerizing a Symfony2 applicationDockerizing a Symfony2 application
Dockerizing a Symfony2 application
 
Docker Introductory workshop
Docker Introductory workshopDocker Introductory workshop
Docker Introductory workshop
 
Introduction to Docker - Learning containerization XP conference 2016
Introduction to Docker - Learning containerization  XP conference 2016Introduction to Docker - Learning containerization  XP conference 2016
Introduction to Docker - Learning containerization XP conference 2016
 
A to Z of a Multi-platform Docker Swarm: Building, Shipping, and Running Mult...
A to Z of a Multi-platform Docker Swarm: Building, Shipping, and Running Mult...A to Z of a Multi-platform Docker Swarm: Building, Shipping, and Running Mult...
A to Z of a Multi-platform Docker Swarm: Building, Shipping, and Running Mult...
 
From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...
From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...
From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...
 
Docker
DockerDocker
Docker
 

Recently uploaded

Sonkoloniya documentation - ONEprojukti.pdf
Sonkoloniya documentation - ONEprojukti.pdfSonkoloniya documentation - ONEprojukti.pdf
Sonkoloniya documentation - ONEprojukti.pdf
SubhamMandal40
 
MAKE MONEY ONLINE Unlock Your Income Potential Today.pptx
MAKE MONEY ONLINE Unlock Your Income Potential Today.pptxMAKE MONEY ONLINE Unlock Your Income Potential Today.pptx
MAKE MONEY ONLINE Unlock Your Income Potential Today.pptx
janagijoythi
 
Accelerating Migrations = Recommendations
Accelerating Migrations = RecommendationsAccelerating Migrations = Recommendations
Accelerating Migrations = Recommendations
isBullShit
 
Google I/O Extended Harare Merged Slides
Google I/O Extended Harare Merged SlidesGoogle I/O Extended Harare Merged Slides
Google I/O Extended Harare Merged Slides
Google Developer Group - Harare
 
Mule Experience Hub and Release Channel with Java 17
Mule Experience Hub and Release Channel with Java 17Mule Experience Hub and Release Channel with Java 17
Mule Experience Hub and Release Channel with Java 17
Bhajan Mehta
 
Finetuning GenAI For Hacking and Defending
Finetuning GenAI For Hacking and DefendingFinetuning GenAI For Hacking and Defending
Finetuning GenAI For Hacking and Defending
Priyanka Aash
 
The Path to General-Purpose Robots - Coatue
The Path to General-Purpose Robots - CoatueThe Path to General-Purpose Robots - Coatue
The Path to General-Purpose Robots - Coatue
Razin Mustafiz
 
UX Webinar Series: Aligning Authentication Experiences with Business Goals
UX Webinar Series: Aligning Authentication Experiences with Business GoalsUX Webinar Series: Aligning Authentication Experiences with Business Goals
UX Webinar Series: Aligning Authentication Experiences with Business Goals
FIDO Alliance
 
It's your unstructured data: How to get your GenAI app to production (and spe...
It's your unstructured data: How to get your GenAI app to production (and spe...It's your unstructured data: How to get your GenAI app to production (and spe...
It's your unstructured data: How to get your GenAI app to production (and spe...
Zilliz
 
Vertex AI Agent Builder - GDG Alicante - Julio 2024
Vertex AI Agent Builder - GDG Alicante - Julio 2024Vertex AI Agent Builder - GDG Alicante - Julio 2024
Vertex AI Agent Builder - GDG Alicante - Julio 2024
Nicolás Lopéz
 
Intel Unveils Core Ultra 200V Lunar chip .pdf
Intel Unveils Core Ultra 200V Lunar chip .pdfIntel Unveils Core Ultra 200V Lunar chip .pdf
Intel Unveils Core Ultra 200V Lunar chip .pdf
Tech Guru
 
Generative AI Reasoning Tech Talk - July 2024
Generative AI Reasoning Tech Talk - July 2024Generative AI Reasoning Tech Talk - July 2024
Generative AI Reasoning Tech Talk - July 2024
siddu769252
 
Russian Girls Call Navi Mumbai 🎈🔥9920725232 🔥💋🎈 Provide Best And Top Girl Ser...
Russian Girls Call Navi Mumbai 🎈🔥9920725232 🔥💋🎈 Provide Best And Top Girl Ser...Russian Girls Call Navi Mumbai 🎈🔥9920725232 🔥💋🎈 Provide Best And Top Girl Ser...
Russian Girls Call Navi Mumbai 🎈🔥9920725232 🔥💋🎈 Provide Best And Top Girl Ser...
bellared2
 
Acumatica vs. Sage Intacct _Construction_July (1).pptx
Acumatica vs. Sage Intacct _Construction_July (1).pptxAcumatica vs. Sage Intacct _Construction_July (1).pptx
Acumatica vs. Sage Intacct _Construction_July (1).pptx
BrainSell Technologies
 
Connector Corner: Leveraging Snowflake Integration for Smarter Decision Making
Connector Corner: Leveraging Snowflake Integration for Smarter Decision MakingConnector Corner: Leveraging Snowflake Integration for Smarter Decision Making
Connector Corner: Leveraging Snowflake Integration for Smarter Decision Making
DianaGray10
 
kk vathada _digital transformation frameworks_2024.pdf
kk vathada _digital transformation frameworks_2024.pdfkk vathada _digital transformation frameworks_2024.pdf
kk vathada _digital transformation frameworks_2024.pdf
KIRAN KV
 
leewayhertz.com-AI agents for healthcare Applications benefits and implementa...
leewayhertz.com-AI agents for healthcare Applications benefits and implementa...leewayhertz.com-AI agents for healthcare Applications benefits and implementa...
leewayhertz.com-AI agents for healthcare Applications benefits and implementa...
alexjohnson7307
 
Zaitechno Handheld Raman Spectrometer.pdf
Zaitechno Handheld Raman Spectrometer.pdfZaitechno Handheld Raman Spectrometer.pdf
Zaitechno Handheld Raman Spectrometer.pdf
AmandaCheung15
 
Semantic-Aware Code Model: Elevating the Future of Software Development
Semantic-Aware Code Model: Elevating the Future of Software DevelopmentSemantic-Aware Code Model: Elevating the Future of Software Development
Semantic-Aware Code Model: Elevating the Future of Software Development
Baishakhi Ray
 
UX Webinar Series: Essentials for Adopting Passkeys as the Foundation of your...
UX Webinar Series: Essentials for Adopting Passkeys as the Foundation of your...UX Webinar Series: Essentials for Adopting Passkeys as the Foundation of your...
UX Webinar Series: Essentials for Adopting Passkeys as the Foundation of your...
FIDO Alliance
 

Recently uploaded (20)

Sonkoloniya documentation - ONEprojukti.pdf
Sonkoloniya documentation - ONEprojukti.pdfSonkoloniya documentation - ONEprojukti.pdf
Sonkoloniya documentation - ONEprojukti.pdf
 
MAKE MONEY ONLINE Unlock Your Income Potential Today.pptx
MAKE MONEY ONLINE Unlock Your Income Potential Today.pptxMAKE MONEY ONLINE Unlock Your Income Potential Today.pptx
MAKE MONEY ONLINE Unlock Your Income Potential Today.pptx
 
Accelerating Migrations = Recommendations
Accelerating Migrations = RecommendationsAccelerating Migrations = Recommendations
Accelerating Migrations = Recommendations
 
Google I/O Extended Harare Merged Slides
Google I/O Extended Harare Merged SlidesGoogle I/O Extended Harare Merged Slides
Google I/O Extended Harare Merged Slides
 
Mule Experience Hub and Release Channel with Java 17
Mule Experience Hub and Release Channel with Java 17Mule Experience Hub and Release Channel with Java 17
Mule Experience Hub and Release Channel with Java 17
 
Finetuning GenAI For Hacking and Defending
Finetuning GenAI For Hacking and DefendingFinetuning GenAI For Hacking and Defending
Finetuning GenAI For Hacking and Defending
 
The Path to General-Purpose Robots - Coatue
The Path to General-Purpose Robots - CoatueThe Path to General-Purpose Robots - Coatue
The Path to General-Purpose Robots - Coatue
 
UX Webinar Series: Aligning Authentication Experiences with Business Goals
UX Webinar Series: Aligning Authentication Experiences with Business GoalsUX Webinar Series: Aligning Authentication Experiences with Business Goals
UX Webinar Series: Aligning Authentication Experiences with Business Goals
 
It's your unstructured data: How to get your GenAI app to production (and spe...
It's your unstructured data: How to get your GenAI app to production (and spe...It's your unstructured data: How to get your GenAI app to production (and spe...
It's your unstructured data: How to get your GenAI app to production (and spe...
 
Vertex AI Agent Builder - GDG Alicante - Julio 2024
Vertex AI Agent Builder - GDG Alicante - Julio 2024Vertex AI Agent Builder - GDG Alicante - Julio 2024
Vertex AI Agent Builder - GDG Alicante - Julio 2024
 
Intel Unveils Core Ultra 200V Lunar chip .pdf
Intel Unveils Core Ultra 200V Lunar chip .pdfIntel Unveils Core Ultra 200V Lunar chip .pdf
Intel Unveils Core Ultra 200V Lunar chip .pdf
 
Generative AI Reasoning Tech Talk - July 2024
Generative AI Reasoning Tech Talk - July 2024Generative AI Reasoning Tech Talk - July 2024
Generative AI Reasoning Tech Talk - July 2024
 
Russian Girls Call Navi Mumbai 🎈🔥9920725232 🔥💋🎈 Provide Best And Top Girl Ser...
Russian Girls Call Navi Mumbai 🎈🔥9920725232 🔥💋🎈 Provide Best And Top Girl Ser...Russian Girls Call Navi Mumbai 🎈🔥9920725232 🔥💋🎈 Provide Best And Top Girl Ser...
Russian Girls Call Navi Mumbai 🎈🔥9920725232 🔥💋🎈 Provide Best And Top Girl Ser...
 
Acumatica vs. Sage Intacct _Construction_July (1).pptx
Acumatica vs. Sage Intacct _Construction_July (1).pptxAcumatica vs. Sage Intacct _Construction_July (1).pptx
Acumatica vs. Sage Intacct _Construction_July (1).pptx
 
Connector Corner: Leveraging Snowflake Integration for Smarter Decision Making
Connector Corner: Leveraging Snowflake Integration for Smarter Decision MakingConnector Corner: Leveraging Snowflake Integration for Smarter Decision Making
Connector Corner: Leveraging Snowflake Integration for Smarter Decision Making
 
kk vathada _digital transformation frameworks_2024.pdf
kk vathada _digital transformation frameworks_2024.pdfkk vathada _digital transformation frameworks_2024.pdf
kk vathada _digital transformation frameworks_2024.pdf
 
leewayhertz.com-AI agents for healthcare Applications benefits and implementa...
leewayhertz.com-AI agents for healthcare Applications benefits and implementa...leewayhertz.com-AI agents for healthcare Applications benefits and implementa...
leewayhertz.com-AI agents for healthcare Applications benefits and implementa...
 
Zaitechno Handheld Raman Spectrometer.pdf
Zaitechno Handheld Raman Spectrometer.pdfZaitechno Handheld Raman Spectrometer.pdf
Zaitechno Handheld Raman Spectrometer.pdf
 
Semantic-Aware Code Model: Elevating the Future of Software Development
Semantic-Aware Code Model: Elevating the Future of Software DevelopmentSemantic-Aware Code Model: Elevating the Future of Software Development
Semantic-Aware Code Model: Elevating the Future of Software Development
 
UX Webinar Series: Essentials for Adopting Passkeys as the Foundation of your...
UX Webinar Series: Essentials for Adopting Passkeys as the Foundation of your...UX Webinar Series: Essentials for Adopting Passkeys as the Foundation of your...
UX Webinar Series: Essentials for Adopting Passkeys as the Foundation of your...
 

Docker, c'est bonheur !

  • 2. Qui je suis ● Alexandre Salomé, développeur (180 mois) ● Consultant technique chez SensioLabs (66 mois) ● En mission chez Auchan e-commerce France (7 mois) – Environnement totalement dockerisé – Bientôt les serveurs de qualification – Dans 3 ans en production ?
  • 4. Sommaire ● Présentation ● Utilisation – Dockerfile – Commandes usuelles – Registry – Volumes – Port mapping – Links ● Outils – Fig – Baseimage – Boot2Docker – Flynn
  • 7. Avantages ● Exécution rapide, isolée et transportable ● Mise en commun des ressources
  • 9. Show time ! La différence du dossier /etc entre : - Ubuntu 14.10 - Ubuntu 12.10 docker run ubuntu:14.10 ls /etc > etc-14.10 docker run ubuntu:12.10 ls /etc > etc-12.10 meld etc-14.10 etc-12.10
  • 11. Commandes usuelles $ docker run --name=mon_redis redis Donner un nom à son conteneur avec --name : docker run redis docker run ubuntu:14.10 ls /etc
  • 12. Commandes usuelles $ docker ps CONTAINER ID IMAGE CREATED STATUS NAMES eb232dde2f79 redis:latest 3 seconds ago Up 2 seconds mon_redis $ docker ps -a CONTAINER ID IMAGE CREATED STATUS PORTS NAMES eb232dde2f79 redis:latest 2 minutes ago Up 2 minutes 6379/tcp mon_redis b715035816d7 redis:latest 4 minutes ago Exited (0) 4 minutes ago sharp_wozniak
  • 13. Commandes usuelles $ docker logs mon_redis [1] 14 Jan 19:35:02.096 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf _._ _.-``__ ''-._ _.-`` `. `_. ''-._ Redis 2.8.17 (00000000/0) 64 bit .-`` .-```. ```/ _.,_ ''-._ ( ' , .-` | `, ) Running in stand alone mode |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379 | `-._ `._ / _.-' | PID: 1 `-._ `-._ `-./ _.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | http://redis.io `-._ `-._`-.__.-'_.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | `-._ `-._`-.__.-'_.-' _.-' `-._ `-.__.-' _.-' `-._ _.-' `-.__.-'
  • 14. Commandes usuelles $ docker inspect mon_redis # ... "Created": "2015-01-14T19:35:01.710341398Z", "Id": "eb232dde2f79741d01d3259566bae6150e5846b3e2e9208a9e6e0897084a80c4", "Image": "3ce54e911389a2b08207b0a4d01c3131ce01b617ecc1c248f6d81ffdbebd628d", "State": { "ExitCode": 0, "FinishedAt": "0001-01-01T00:00:00Z", "Paused": false, "Pid": 4362, "Restarting": false, "Running": true, "StartedAt": "2015-01-14T19:35:02.053470372Z" # ... $ docker inspect -f="{{ .NetworkSettings.IPAddress }}" mon_redis 172.17.0.3
  • 15. Commandes usuelles $ docker diff mon_redis A /tmp/sess_b86hok0pfj23a81ea3flr0rk03 C /tmp/sess_esmblquiab21m995q2d195j1r5 D /tmp/sess_gl0cmpknk3rirc3l0jmjfd1bo1 C /tmp/sess_ql581nl6ac0uhaj47cftn8ipb7 Afficher le différentiel d'un conteneur :
  • 16. Commandes usuelles $ docker run -d --name=mon_redis redis $ docker stop mon_redis Démarrer en arrière plan avec -d : Arrêter un conteneur :
  • 17. Commandes usuelles $ docker exec mon_redis ls /etc Exécuter une commande dans un conteneur démarré :
  • 18. Commandes usuelles $ docker rmi redis Supprimer une image $ docker rm mon_redis Supprimer un conteneur $ docker stop mon_redis Arrêter un conteneur
  • 19. $ docker Commands: attach Attach to a running container build Build an image from a Dockerfile commit Create a new image from a container's changes cp Copy files/folders from a container's filesystem to the host path diff Inspect changes on a container's filesystem events Get real time events from the server export Stream the contents of a container as a tar archive history Show the history of an image images List images import Create a new filesystem image from the contents of a tarball info Display system-wide information inspect Return low-level information on a container kill Kill a running container load Load an image from a tar archive login Register or log in to a Docker registry server logout Log out from a Docker registry server logs Fetch the logs of a container port Lookup the public-facing port that is NAT-ed to PRIVATE_PORT pause Pause all processes within a container ps List containers pull Pull an image or a repository from a Docker registry server push Push an image or a repository to a Docker registry server restart Restart a running container rm Remove one or more containers rmi Remove one or more images run Run a command in a new container save Save an image to a tar archive search Search for an image on the Docker Hub start Start a stopped container stop Stop a running container tag Tag an image into a repository top Lookup the running processes of a container unpause Unpause a paused container version Show the Docker version information wait Block until a container stops, then print its exit code
  • 21. Dockerfile ● Recette de construction d'un conteneur ● Format de fichier simple FROM ubuntu:14.10 ENV APACHE_LOG_DIR /var/log/apache2 RUN apt-get install -y apache2 ADD site.conf /path/to/site.conf EXPOSE 80 CMD ["/usr/sbin/apache2", "-D", "FOREGROUND"] Exemple non fonctionnel, parce que Apache, c'est pas aussi simple Dans cet exemple, le Dockerfile fait 5 lignes
  • 23. Dockerfile $ vi Dockerfile $ docker run alex/apache $ docker build --name=alex/apache . Step 0 : FROM ubuntu:14.10 ---> 75204fdb260b Step 1 : RUN apt-get install apache2 ---> Running in 68992170d55d Reading package lists... Building dependency tree... Reading state information... Step 2 : ... ---> Running in 68992170d55d ...
  • 24. Dockerfile FROM phusion/baseimage:0.9.13 ENV HOME /root EXPOSE 80 EXPOSE 22 CMD /sbin/my_init RUN apt-get update RUN apt-get install -y git curl postgresql php5-cli php5-fpm php5-intl php5-mcrypt php5-json php5-pgsql php5-curl redis-server openjdk-7-jre nginx # Setup elasticsearch RUN cd /tmp && curl -o /tmp/elasticsearch-1.3.2.tar.gz https://download.elasticsearch.org/elasticsearch/elasticsearch/elasti csearch-1.3.2.tar.gz && tar xvzf elasticsearch-1.3.2.tar.gz && rm -f elasticsearch-1.3.2.tar.gz && mv /tmp/elasticsearch-1.3.2 /elasticsearch # Setup postgresql RUN /etc/init.d/postgresql start && sudo -u postgres psql --command "CREATE USER gitonomy WITH SUPERUSER PASSWORD 'gitonomy';" && sudo -u postgres createdb -O gitonomy gitonomy RUN echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/9.3/main/pg_hba.conf RUN echo "listen_addresses='*'" >> /etc/postgresql/9.3/main/postgresql.conf # Node stuff RUN curl -sL https://deb.nodesource.com/setup | bash - RUN apt-get install -y nodejs RUN npm install -g bower grunt-cli# composer RUN curl -o /tmp/composer http://getcomposer.org/composer.phar; mv /tmp/composer /usr/bin/composer; chmod a+x /usr/bin/composer ADD config/nginx.conf /etc/nginx/nginx.conf ADD config/php-fpm.conf /etc/php5/fpm/pool.d/www.conf ADD service/nginx.sh /etc/service/nginx/run ADD service/php-fpm.sh /etc/service/php-fpm/run ADD service/postgresql.sh /etc/service/postgresql/run ADD service/elasticsearch.sh /etc/service/elasticsearch/run ADD service/redis.sh /etc/service/redis/run ADD startup.sh /etc/my_init.d/gitonomy Dans la vraie vie, les Dockerfile font 200 lignes
  • 26. Docker Registry Client (vous) Registry PUSH PULL Intégration continue PUSH Sourcecode PUSH Stocker les images pour éviter les constructions
  • 27. Registry $ docker tag alex/apache registry.acme.org/alex/apache $ docker push registry.acme.org/alex/apache
  • 28. Volumes ● Permet de partager des dossiers entre les conteneurs et le système hôte $ docker run -v /home/alex/public:/var/www my_apache Le chemin sur mon système Le chemin dans le conteneur
  • 29. Port mapping ● Permet d'exposer des ports du conteneur sur l'hôte $ docker run -p 8000:80 my_apache Le port sur mon système Le port dans le conteneur
  • 30. Links $ docker run --link mon_redis:mon_redis ubuntu env MON_REDIS_PORT=tcp://172.17.0.2:6379 MON_REDIS_PORT_6379_TCP=tcp://172.17.0.2:6379 MON_REDIS_PORT_6379_TCP_ADDR=172.17.0.2 MON_REDIS_PORT_6379_TCP_PORT=6379 MON_REDIS_PORT_6379_TCP_PROTO=tcp
  • 31. Résumé des fonctionnalités docker run -v /home/alex/public:/var/www -p 8000:80 --link project_db --name project_web my_apache docker run --name=project_db my_mysql
  • 33. fig web: build: . links: - db volumes: - /var/www:/var/www ports: - "8000:8000" db: image: postgres $ fig up web $ docker build --name=web . $ docker run -p 8000:8000 -v /var/www:/var/www --link db web
  • 34. phusion/baseimage ● Framework pour conteneurs Docker ● Multi-process assumé
  • 35. boot2docker ● Pour les utilisateurs Mac ● Bon courage, surtout pour les volumes Macintosh VirtualBox Linux Docker
  • 36. Mais aussi… ● Flynn : automatisation des déploiements ● Shipyard : Docker management ● Mesos & Marathon : Scale ● Gaudi : fig + UI ● Panamax : gestionnaire de conteneurs
  • 37. En conclusion ● Isolez vos projets de votre système ● Versionnez vos Dockerfile ● Automatisez la construction de vos projets