Skip to content

Instantly share code, notes, and snippets.

@rayhassan
Created May 11, 2017 13:26
Show Gist options
  • Save rayhassan/f563ca9446eb7a0db2c5a60045a718a1 to your computer and use it in GitHub Desktop.
Save rayhassan/f563ca9446eb7a0db2c5a60045a718a1 to your computer and use it in GitHub Desktop.
Useful notes on Docker swarm config
Docker Hub hosted backend (for test/qa)
=======================================
o create dicovery token
# sid=$(docker run swarm create)
# echo $sid
d3e9cb54c894a7e3ae4c21145b9194bb
o create swarm master node
# docker-machine create -d nutanix --nutanix-username admin --nutanix-password 'nutanix/4u' --nutanix-endpoint '10.68.64.55:9440' --nutanix-vm-image Docker-Machine-Image --nutanix-vm-network 'vlan.68' --swarm --swarm-master --swarm-discovery token://$sid swarm-master
o create additional swarm nodes as required
# docker-machine create -d nutanix --nutanix-username admin --nutanix-password 'nutanix/4u' --nutanix-endpoint '10.68.64.55:9440' --nutanix-vm-image Docker-Machine-Image --nutanix-vm-network 'vlan.68' --swarm --swarm-discovery token://$sid swarm01
o check swarm config
# docker run swarm list token://d3e9cb54c894a7e3ae4c21145b9194bb
10.68.68.157:2376
10.68.68.156:2376
10.68.68.155:2376
10.68.68.147:2376
eval $(docker-machine env --swarm swarm-master)
docker info
(should show all nodes healthy for ctr placement)
Distributed keystore backend (consul)
=====================================
o create keystore machine :
docker-machine create -d nutanix --nutanix-username admin --nutanix-password 'nutanix/4u' --nutanix-endpoint '10.68.64.55:9440' --nutanix-vm-image Docker-Machine-Image --nutanix-vm-network 'vlan.68' consul
o run consul backend as a ctr
docker $(docker-machine config consul) run --restart=unless-stopped -d -p "8500:8500" --name consul progrium/consul -server -bootstrap
o create swarm manager
docker-machine create -d nutanix --nutanix-username admin --nutanix-password 'nutanix/4u' --nutanix-endpoint '10.68.64.55:9440' --nutanix-vm-image Docker-Machine-Image --nutanix-vm-network 'vlan.68' --swarm --swarm-master --swarm-discovery="consul://$(docker-machine ip consul):8500" --engine-opt="cluster-store=consul://$(docker-machine ip consul):8500" --engine-opt="cluster-advertise=eth0:2376" manager
o create additional swarm nodes as required
docker-machine create -d nutanix --nutanix-username admin --nutanix-password 'nutanix/4u' --nutanix-endpoint '10.68.64.55:9440' --nutanix-vm-image Docker-Machine-Image --nutanix-vm-network 'vlan.68' --swarm --swarm-discovery="consul://$(docker-machine ip consul):8500" --engine-opt="cluster-store=consul://$(docker-machine ip consul):8500" --engine-opt="cluster-advertise=eth0:2376" node01
o check swarm config :
eval $(docker-machine env --swarm manager)
docker run swarm list consul://$(docker-machine ip consul):8500/swarm
docker info
>>> should show all nodes healthy
e `docker-machine upgrade` command won’t install it. If you create a new machine and use the ` --engine-install-url "https://test.docker.com/"` flag, it will.
[20:22]
Thats until 1.12 goes final, then the upgrade command will work.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment