Last active
May 5, 2016 08:54
-
-
Save arun-gupta/4d3e5243dac244dc8c9e8ca07b0c9f2a to your computer and use it in GitHub Desktop.
Create Docker Swarm with Rescheduling Containers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Docker Machine for Consul | |
| docker-machine \ | |
| create \ | |
| -d virtualbox \ | |
| consul-machine | |
| # Start Consul | |
| docker $(docker-machine config consul-machine) run -d --restart=always \ | |
| -p "8500:8500" \ | |
| -h "consul" \ | |
| progrium/consul -server -bootstrap | |
| # Docker Swarm master | |
| docker-machine \ | |
| create \ | |
| -d virtualbox \ | |
| --swarm \ | |
| --swarm-master \ | |
| --swarm-discovery="consul://$(docker-machine ip consul-machine):8500" \ | |
| --engine-opt="cluster-store=consul://$(docker-machine ip consul-machine):8500" \ | |
| --engine-opt="cluster-advertise=eth1:2376" \ | |
| --swarm-opt="engine-refresh-min-interval=1s" \ | |
| --swarm-opt="engine-refresh-max-interval=1s" \ | |
| --swarm-opt="engine-failure-retry=1" \ | |
| swarm-master | |
| # Docker Swarm node-01 | |
| docker-machine \ | |
| create \ | |
| -d virtualbox \ | |
| --swarm \ | |
| --swarm-discovery="consul://$(docker-machine ip consul-machine):8500" \ | |
| --engine-opt="cluster-store=consul://$(docker-machine ip consul-machine):8500" \ | |
| --engine-opt="cluster-advertise=eth1:2376" \ | |
| --swarm-opt="engine-refresh-min-interval=1s" \ | |
| --swarm-opt=engine-refresh-max-interval=1s" \ | |
| --swarm-opt=engine-failure-retry=1" \ | |
| swarm-node-01 | |
| # Docker Swarm node-02 | |
| docker-machine \ | |
| create \ | |
| -d virtualbox \ | |
| --virtualbox-disk-size "5000" \ | |
| --swarm \ | |
| --swarm-discovery="consul://$(docker-machine ip consul-machine):8500" \ | |
| --engine-opt="cluster-store=consul://$(docker-machine ip consul-machine):8500" \ | |
| --engine-opt="cluster-advertise=eth1:2376" \ | |
| --swarm-opt="engine-refresh-min-interval=1s" \ | |
| --swarm-opt="engine-refresh-max-interval=1s" \ | |
| --swarm-opt="engine-failure-retry=1" \ | |
| swarm-node-02 | |
| # Configure to use Docker Swarm cluster | |
| eval "$(docker-machine env --swarm swarm-master)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment