Académique Documents
Professionnel Documents
Culture Documents
• Pour désigner une machine en tant que « master » : docker swarm init
• Une commande sera fournie à la fin du process d’init du master. Il
faudrait l’exécuter sur les différentes autres machines destinées à
devenir des « workers ». Elles seront ainsi rattachées au master
désigné plus haut.
HELP : docker swarm help
root@docker-master:~# docker swarm help
Manage Swarm
Commands:
ca Display and rotate the root CA
init Initialize a swarm
join Join a swarm as a node and/or manager
join-token Manage join tokens
leave Leave the swarm
unlock Unlock swarm
unlock-key Manage the unlock key
update Update the swarm
Manage services
Commands:
create Create a new service
inspect Display detailed information on one or more services
logs Fetch the logs of a service or task
ls List services
ps List the tasks of one or more services
rm Remove one or more services
rollback Revert changes to a service's configuration
scale Scale one or multiple replicated services
update Update a service
To add a manager to this swarm, run 'docker swarm join-token manager' and follow
the instructions.
Exemple de configuration et installation (3/5)
• Rattacher des workers au « swarm manager »
root@docker-master:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS
NAMES
5286e4c297c6 nginx:latest "nginx -g 'daemon of…" 5 minutes ago Up 5 minutes 80/tcp
my-nginx-service.2.twk7ssgckwkjkd27pq1dpkzk0
Scalabilité (1/3)
• Si jamais votre application a besoin de ressources supplémentaire
(montée en charge), « Docker swarm » peut vous aider en instanciant
de nouveaux containers du service en question :