Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Comandos demonstrando o uso do Docker 1.12 Swarm Mode
Instalar Docker 1.12 no Linux:
- sudo su
- curl -fsSL https://experimental.docker.com/ | sh
Instalar Docker-machine v0.8.0 no Linux:
- curl -L https://github.com/docker/machine/releases/download/v0.8.0-rc2/docker-machine-`uname -s`-`uname -m` >/usr/local/bin/docker-machine
- chmod +x /usr/local/bin/docker-machine
Criar VM's com Docker Engine:
- docker-machine create -d virtualbox master
- docker-machine create -d virtualbox worker1
- docker-machine create -d virtualbox worker2
Listar todas VM's para obter os IP's:
- docker-machine ls
SSH em cada node:
- ssh docker@<ip node>
- senha: tcuser
Node 1 - Criar container com a UI (Acessar <ip node 1>:5000 no navegador):
- docker run -it -d -p 5000:5000 -e HOST=<ip node 1> -e PORT=5000 -v /var/run/docker.sock:/var/run/docker.sock manomarks/visualizer
Node 1 - Iniciar cluster:
- docker swarm init
Node 2 - Adicionar worker ao cluster:
- docker swarm join <ip node 1>:2377
Node 3 - Adicionar worker ao cluster:
- docker swarm join <ip node 1>:2377
Node 1 - Listar todos nodes do cluster:
- docker node ls
Node 1 - Criar service:
- docker service create --replicas 1 --name voteapp -p 8080:80 instavote/vote
Node 1 - Listar services:
- docker service ls
Node 1 - Listar tasks do service voteapp:
- docker service tasks voteapp
Node 1 - Escalar para 6 tasks:
docker service scale voteapp=6
Node 1 - Alterar imagem:
docker service update --image instavote/vote:movies voteapp --update-delay 15s --update-parallelism 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.