5. Installation Docker
● curl -sL https://get.docker.io/ | sh
● wget -qO- https://get.docker.io/ | sh
● docker –help
● Attention apt-get install docker sous debian/ubuntu
n'installera pas docker mais un package pour le
system tray kde3/gnome2
– https://packages.debian.org/jessie/docker
● Utiliser apt-get install docker.io sous ubuntu, mais le
mieux étant d'utiliser le package de get.docker.io
7. Image vs Container
● Image == pseudo disque dur contenant les
informations, le système
● Container == environnement démarré
● Une image peut avoir plusieurs container qui
l'utilise avec des paramètres différents
8. Les commandes à connaître
● docker ps
● docker log
● docker run (rm)
● docker build
● docker <cmd> help
● docker stats
● docker images (rmi)
● docker inspect
9. Construire sa première image
● Utilisation d'un fichier qui décrit comment
construire l'image, le dockerfile
● Syntaxe simple
– Exemple : RUN apt-get update
● On peut réutiliser une image existante pour
étendre la sienne
– FROM ubuntu
10. Le dockerfile
from python:2.7
MAINTAINER Sylvain Boily "sboily@avencall.com"
RUN apt-get -yq update
&& apt-get -yqq dist-upgrade
&& apt-get -yq autoremove
ADD . /usr/src/admin
WORKDIR /usr/src/admin
RUN pip install -r requirements.txt
RUN python setup.py install
EXPOSE 80
CMD python run.py
11. Example avec XiVO
● Test
– http://blog.xivo.io/index.php?post/2014/12/03/How-we-te
● Développement
– http://github.com/xivo-pbx
– Demo !
● Orchestration
– http://github.com/sboily/config/docker-compose.yml
13. Orchestration
● Docker-compose
– Installation simple : pip install docker-compose
● Fonctionne avec un fichier YAML pour décrire
comment on orchestre le système
● Exemple sur mon github avec XiVO
– https://github.com/sboily/config/blob/master/docker-
compose.yml
14. Autres composants
● Docker swarm
– Mettre en œuvre du cluster nativement avec docker
– https://docs.docker.com/swarm/
● Docker machine
– Déployer docker sur vos serveurs, cloud public etc
… simplement
– https://docs.docker.com/machine/
– docker-machine create -d virtualbox dev
15. $ docker-machine create -d virtualbox dev
INFO[0000] Creating SSH key...
INFO[0000] Creating VirtualBox VM...
INFO[0007] Starting VirtualBox VM...
INFO[0007] Waiting for VM to start...
INFO[0041] "dev" has been created and is now the active machine.
INFO[0041] To point your Docker client at it, run this in your shell: eval "$(docker-machine env dev)"
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM
dev * virtualbox Running tcp://192.168.99.127:2376
$ eval "$(docker-machine env dev)"
$ docker run busybox echo hello world
Unable to find image 'busybox:latest' locally
511136ea3c5a: Pull complete
df7546f9f060: Pull complete
ea13149945cb: Pull complete
4986bf8c1536: Pull complete
hello world
Docker machine
16. Docker API REST
● https://docs.docker.com/reference/api/docker_remo
● Permet de controler le daemon comme le client
en CLI
17. Interface de gestion
● https://github.com/crosbymichael/dockerui
● docker run -d -p 9000:9000 --privileged -v
/var/run/docker.sock:/var/run/docker.sock
dockerui/dockerui
● Ouvrir un navigateur web sur le port 9000!