SlideShare una empresa de Scribd logo
1 de 37
Descargar para leer sin conexión
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
Avantages
● Exécution rapide, isolée et transportable
● Mise en commun des ressources
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

Más contenido relacionado

La actualidad más candente

Configuration Surgery with Augeas
Configuration Surgery with AugeasConfiguration Surgery with Augeas
Configuration Surgery with AugeasPuppet
 
Docker command
Docker commandDocker command
Docker commandEric 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-apiEric 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 ProductionBen Hall
 
Instruction: dev environment
Instruction: dev environmentInstruction: dev environment
Instruction: dev environmentSoshi Nemoto
 
#OktoCampus - Workshop : An introduction to Ansible
#OktoCampus - Workshop : An introduction to Ansible#OktoCampus - Workshop : An introduction to Ansible
#OktoCampus - Workshop : An introduction to AnsibleCédric Delgehier
 
Learn basic ansible using docker
Learn basic ansible using dockerLearn basic ansible using docker
Learn basic ansible using dockerLarry Cai
 
IT Automation with Ansible
IT Automation with AnsibleIT Automation with Ansible
IT Automation with AnsibleRayed 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 2012Carlos Sanchez
 
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 ClicksCarlos Sanchez
 
Ansible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife OrchestrationAnsible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife Orchestrationbcoca
 
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
 

La actualidad más candente (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 a Docker, c'est bonheur !

Hands-On Session Docker
Hands-On Session DockerHands-On Session Docker
Hands-On Session DockerLinetsChile
 
[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 OverviewLeo 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 infrastructureSergiy Kukunin
 
Docker workshop
Docker workshopDocker workshop
Docker workshopEvans Ye
 
Docker Security workshop slides
Docker Security workshop slidesDocker Security workshop slides
Docker Security workshop slidesDocker, Inc.
 
Docker Introduction.pdf
Docker Introduction.pdfDocker Introduction.pdf
Docker Introduction.pdfOKLABS
 
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 environmentSumedt Jitpukdebodin
 
Docker in Action
Docker in ActionDocker in Action
Docker in ActionAlper Kanat
 
PDXPortland - Dockerize Django
PDXPortland - Dockerize DjangoPDXPortland - Dockerize Django
PDXPortland - Dockerize DjangoHannes Hapke
 
Docker for mere mortals
Docker for mere mortalsDocker for mere mortals
Docker for mere mortalsHenryk 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 produccionSysdig
 
手把手帶你學Docker 03042017
手把手帶你學Docker 03042017手把手帶你學Docker 03042017
手把手帶你學Docker 03042017Paul Chao
 
Dockerizing a Symfony2 application
Dockerizing a Symfony2 applicationDockerizing a Symfony2 application
Dockerizing a Symfony2 applicationRoman Rodomansky
 
Docker Introductory workshop
Docker Introductory workshopDocker Introductory workshop
Docker Introductory workshopRuncy 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 2016XP 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.
 

Similar a 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
 

Último

TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 

Último (20)

TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 

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
  • 6.
  • 7. Avantages ● Exécution rapide, isolée et transportable ● Mise en commun des ressources
  • 8.
  • 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