18. QU’EST-CE DOCKER ?
Docker est la principale plateforme pour les conteneurs
Développeurs Utilise Docker pour éliminer le problème du “ça marche sur mon poste”
Admin Système
Utilise Docker pour rouler et gérer des apps fonctionnant côte à côte
dans des conteneurs isolées
Entreprise
Utilise Docker pour construire des pipelines agiles pour livrer de
nouvelles fonctionnalités plus rapidement, plus sécuritaire, plus
facilement scalable et avec une plus grande confiance
19. ÉVOLUTION DE LA PLATEFORME DOCKER
▸ Un seul but
▸ Communauté des développeurs
sous linux seulement
20. ÉVOLUTION DE LA PLATEFORME DOCKER
Développeurs Ops Entreprises Ecosystème
Besoin d’expérimenter
et d’innover avec des
technologies à jour
Besoin d’un système
prévisible pour
déployer et faire
tourner des apps
Fait tourner des apps
business critiques
scalable et n’importe
où
Ajouter de la valeur et
étendre une
plateforme avec un
moyen commun de
monétisation
21. LA PLATEFORME DOCKER
Développeurs Ops Entreprises Ecosystème
Une plateforme
Pour les développeurs et les équipes TI
Sur Linux et Windows
On premise et dans le nuage
Apps traditionnelles, vendeur de solution, microservices
22. DOCKER COMMUNITY EDITION (CE) ET DOCKER ENTERPRISE EDITION (EE)
▸ Plateforme Docker gratuite
pour les Devs et Ops “do it yourself”
▸ Release mensuelle avec les dernières
fonctionnalités pour les développeurs
▸ Release trimestrielle avec maintenance
pour les Ops
▸ Plateforme CaaS avec un abonnement
(inclue l’orchestration des containers,
la gestion et la sécurité)
▸ Support de niveau entreprise
▸ Release trimestrielle avec 1 ans de
support chaque incluant les patches et
hotfixes
▸ Technologie certifiée: Infrastructure,
plugins et container
23. VERSIONS ET SUPPORT
▸ NEW! Les versions de Docker suit maintenant le format YY.MM
▸ `docker-engine` package n’existe plus, c’est maintenant `docker-ce` et `docker-ee`
25. QU’EST-CE QU’UN CONTENEUR ?
▸ Packaging standardisé pour les apps
et leurs dépendances
▸ Isole les apps l’une de l’autre
▸ Partage le même Kernel que l’OS
▸ Fonctionne sur les principales
distributions Linux
▸ Natif dans Windows Server 2016
26. LA DIFFÉRENCE ENTRE UN CONTENEUR ET UNE VM
Un conteneur est un élément
au niveau applicatif
Une VM est un élément au niveau
de l’infrastructure
27. CONTENEURS ET VMS ENSEMBLE
L’utilisation des conteneurs et des VMs permet une plus grande flexibilité
pour déployer et gérer des apps de manière optimale
28. “Mais en plus concret, c’est quoi un
container ?
-Un autre anonyme
31. IMAGE
▸ Une image est une référence à une liste de layer en “read only”
▸ Les layers sont stacké l’un au dessus de l’autre pour former le
filesystem
▸ Chaque layers peuvent être utilisé par plusieurs images
▸ Le driver de stockage de Docker est responsable de stacké les
images et de fournir une vue unifié
32. CONSTRUIRE UNE IMAGE
FROM mhart/alpine-node:6
ENV SERVICE_3000_NAME selfpro
WORKDIR /src
ADD . .
RUN apk add --update --no-cache git &&
npm install
EXPOSE 3000
CMD npm start
Dockerfile
38. CONSTRUIRE UNE IMAGE
~/work/selfpro docker history cce4c583c3a0
IMAGE CREATED CREATED BY SIZE
cce4c583c3a0 2 minutes ago /bin/sh -c #(nop) CMD ["/bin/sh" "-c" "npm s 0 B
110c49285fe1 2 minutes ago /bin/sh -c #(nop) EXPOSE 3000/tcp 0 B
579469b24848 2 minutes ago /bin/sh -c apk add --update --no-cache git && 54.16 MB
5b34c5ef9a7f 3 minutes ago /bin/sh -c #(nop) %s %s in %s ADD dir:b07dd1 1.044 MB
6ba4a61f509a 3 minutes ago /bin/sh -c #(nop) WORKDIR /src 0 B
9d9b1f86a696 3 minutes ago /bin/sh -c #(nop) ENV SERVICE_3000_NAME=self 0 B
2e8721f40082 3 weeks ago /bin/sh -c apk add --no-cache curl make gcc g 41.44 MB
<missing> 3 weeks ago /bin/sh -c #(nop) ENV VERSION=v6.2.1 NPM_VERS 0 B
<missing> 3 weeks ago /bin/sh -c #(nop) ADD file:701fd33a2f463fd4bd 4.799 MB
39. CONSTRUIRE UNE IMAGE
~/work/selfpro docker history cce4c583c3a0
IMAGE CREATED CREATED BY SIZE
cce4c583c3a0 2 minutes ago /bin/sh -c #(nop) CMD ["/bin/sh" "-c" "npm s 0 B
110c49285fe1 2 minutes ago /bin/sh -c #(nop) EXPOSE 3000/tcp 0 B
579469b24848 2 minutes ago /bin/sh -c apk add --update --no-cache git && 54.16 MB
5b34c5ef9a7f 3 minutes ago /bin/sh -c #(nop) %s %s in %s ADD dir:b07dd1 1.044 MB
6ba4a61f509a 3 minutes ago /bin/sh -c #(nop) WORKDIR /src 0 B
9d9b1f86a696 3 minutes ago /bin/sh -c #(nop) ENV SERVICE_3000_NAME=self 0 B
2e8721f40082 3 weeks ago /bin/sh -c apk add --no-cache curl make gcc g 41.44 MB
<missing> 3 weeks ago /bin/sh -c #(nop) ENV VERSION=v6.2.1 NPM_VERS 0 B
<missing> 3 weeks ago /bin/sh -c #(nop) ADD file:701fd33a2f463fd4bd 4.799 MB
~/work/selfpro docker history petalmd/selfpro
40. AVANTAGES DES IMAGES
▸ Chaque layers peuvent être utilisé par plusieurs images
▸ Une image peut être construite au dessus d’une autre image
▸ Un site static peut être construit par dessus l’image de nginx,
qui peut, elle même être construit par dessus alpine Linux
▸ Construire une image peut se résumer à juste reconstruire le
dernier layer
43. DOCKER ENGINE
▸ Client-Server application qui permet:
▸ Gérer des images
▸ Gérer des conteneurs
▸ Gérer des réseaux
▸ Gérer des volumes
▸ Possède une API REST et un CLI
44. DOCKER COMPOSE
▸ Définie une application multi-
containers utilisants plusieurs
dépendances dans un seul fichier
▸ Contient la structure et la
configuration en une place
▸ Démarre (ou arrête) une application
en une seul command
49. DEMO
~/work/wordpress docker-compose up -d
Creating network "wordpress_default" with the default driver
Creating volume "wordpress_db_data" with default driver
Creating wordpress_mysql_1
Creating wordpress_wordpress_1
50. DEMO
~/work/wordpress docker-compose up -d
Creating network "wordpress_default" with the default driver
Creating volume "wordpress_db_data" with default driver
Creating wordpress_mysql_1
Creating wordpress_wordpress_1
~/work/wordpress docker-compose ps
Name Command State Ports
-------------------------------------------------------------------------------------
wordpress_mysql_1 docker-entrypoint.sh mysqld Up 3306/tcp
wordpress_wordpress_1 docker-entrypoint.sh apach ... Up 0.0.0.0:8080->80/tcp
51. DEMO
~/work/wordpress docker-compose up -d
Creating network "wordpress_default" with the default driver
Creating volume "wordpress_db_data" with default driver
Creating wordpress_mysql_1
Creating wordpress_wordpress_1
~/work/wordpress docker-compose ps
Name Command State Ports
-------------------------------------------------------------------------------------
wordpress_mysql_1 docker-entrypoint.sh mysqld Up 3306/tcp
wordpress_wordpress_1 docker-entrypoint.sh apach ... Up 0.0.0.0:8080->80/tcp
52. DOCKER REGISTRY
▸ Stock et distribue les images Docker
▸ De nombreux Registry hébergés
disponibles:
▸ Docker Hub, AWS ECR, …
▸ Peut être self-hosted avec plusieurs
intégrations pour le stockage:
▸ Local, AWS S3, Ceph, OpenStack
Swift, …
53. DOCKER MACHINE
▸ Provisionne et configure Docker sur
un serveur distant
▸ Fonctionne avec la plus part des
cloud providers
▸ AWS / GCE / Azure / DO / IBM
▸ Fonctionne aussi avec des
technologies standards
▸ OpenStack / vCenter
56. DOCKER MACHINE
Running pre-create checks...
Creating machine...
(swarm1) Creating SSH key...
(swarm1) Creating Digital Ocean droplet...
(swarm1) Waiting for IP address to be assigned to the Droplet...
Waiting for machine to be running, this may take a few minutes...
Detecting operating system of created instance...
Waiting for SSH to be available...
Detecting the provisioner...
Provisioning with ubuntu(systemd)...
Installing Docker...
57. DOCKER MACHINE
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
Checking connection to Docker...
Docker is up and running!
To see how to connect your Docker Client to the Docker Engine running on this
virtual machine, run: docker-machine env swarm1
58. DOCKER MACHINE
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
Checking connection to Docker...
Docker is up and running!
To see how to connect your Docker Client to the Docker Engine running on this
virtual machine, run: docker-machine env swarm1
~/work eval $(docker-machine env swarm1)
59. DOCKER MACHINE
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
Checking connection to Docker...
Docker is up and running!
To see how to connect your Docker Client to the Docker Engine running on this
virtual machine, run: docker-machine env swarm1
~/work eval $(docker-machine env swarm1)
~/work docker info
60. DOCKER MACHINE
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
Checking connection to Docker...
Docker is up and running!
To see how to connect your Docker Client to the Docker Engine running on this
virtual machine, run: docker-machine env swarm1
~/work eval $(docker-machine env swarm1)
~/work docker info
CPUs: 1
Total Memory: 992.4MiB
Name: swarm1
Labels:
provider=digitalocean
61. DOCKER SWARM
▸ Transforme un groupe de serveurs docker en
un cluster
▸ Gestion du cluster inclue dans le Docker
Engine
▸ Décentralisé
▸ Declarative service model
▸ Scaling
▸ Secure by default
▸ Service discovery
▸ Multi-host networking
▸ Rolling Update
64. DOCKER SWARM
~/work docker swarm init --advertise-addr 138.197.149.25
Swarm initialized: current node (fymao87flfrbkstg7gyzdx4ov) is now a manager.
To add a worker to this swarm, run the following command:
docker swarm join
--token SWMTKN-1-0vy0ta7rz8t1sblq3o63s83nvnhy7ddxyczp4w50hs9dipbpg6-xx
138.197.149.25:2377
To add a manager to this swarm, run 'docker swarm join-token manager' and follow
the instructions.
67. DOCKER SWARM
~/work docker swarm join
--token SWMTKN-1-0vy0ta7rz8t1sblq3o63s83nvnhy7ddxyczp4w50hs9dipbpg6-xx
138.197.149.25:2377
This node joined a swarm as a worker.
68. DOCKER SWARM
~/work docker swarm join
--token SWMTKN-1-0vy0ta7rz8t1sblq3o63s83nvnhy7ddxyczp4w50hs9dipbpg6-xx
138.197.149.25:2377
This node joined a swarm as a worker.
~/work docker node ls
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
c2lyl7ail0r68c141zidbovpl swarm2 Ready Active
fymao87flfrbkstg7gyzdx4ov * swarm1 Ready Active Leader
69. DOCKER CLOUD
▸ Solution commerciale de Docker
pour faire des pipelines de CI / CD
▸ Se hook sur Github et Bitbucket pour
construire des images et les
déployer automatiquement
▸ Utilise nos serveurs ou se branche
sur des cloud providers
▸ Facturation par node par heure
72. CONTINUOUS INTEGRATION
Jenkins Master Jenkins Slave Docker Registry
• Jenkins in Docker
• Auto provisionning
• Only docker running
on host
• Jenkins agent running
in Docker
• For storing Docker
image
• Private or public
• On promise or not
73. CI / CD
If the test is successful,
the image is pushed to the
Registry
76. STAGING AUTO DEPLOYING WITH WORDPRESS
▸ Construire une nouvelle version à chaque git push
77. STAGING AUTO DEPLOYING WITH WORDPRESS
▸ Construire une nouvelle version à chaque git push
▸ Construire une image pour Wordpress et une autre pour
MySQL
78. STAGING AUTO DEPLOYING WITH WORDPRESS
▸ Construire une nouvelle version à chaque git push
▸ Construire une image pour Wordpress et une autre pour
MySQL
▸ Déployer automatiquement à chaque build
79. STAGING AUTO DEPLOYING WITH WORDPRESS
▸ Construire une nouvelle version à chaque git push
▸ Construire une image pour Wordpress et une autre pour
MySQL
▸ Déployer automatiquement à chaque build
▸ Avoir une URL utilisable