Created
November 21, 2015 08:58
-
-
Save gregory/0aeaf4a433737f02f050 to your computer and use it in GitHub Desktop.
Docker 1.9.0 - Using docker-machine, swarm and overlay networking with etcd
This file contains 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 create -d virtualbox cluster-store | |
CLUSTER_STORE_IP=$(docker-machine ip cluster-store) | |
docker $(docker-machine config cluster-store) run -d \ | |
--restart="always" \ | |
--publish="2379:2379" \ | |
microbox/etcd:2.1.1 \ | |
-name etcd0 \ | |
-advertise-client-urls http://${CLUSTER_STORE_IP}:2379 \ | |
-listen-client-urls http://0.0.0.0:2379 \ | |
-initial-cluster-state new | |
docker-machine create \ | |
-d virtualbox \ | |
--swarm \ | |
--swarm-master \ | |
--swarm-discovery="etcd://$(docker-machine ip cluster-store):2379/swarm" \ | |
--engine-opt="cluster-advertise=eth1:2376" \ | |
--engine-opt="cluster-store=etcd://$(docker-machine ip cluster-store):2379/store" \ | |
swarm-0 | |
docker-machine create \ | |
-d virtualbox \ | |
--swarm \ | |
--swarm-discovery="etcd://$(docker-machine ip cluster-store):2379/swarm" \ | |
--engine-opt="cluster-advertise=eth1:2376" \ | |
--engine-opt="cluster-store=etcd://$(docker-machine ip cluster-store):2379/store" \ | |
swarm-1 | |
eval $(docker-machine env --swarm swarm-0) | |
docker network create -d overlay multihost | |
docker run -d \ | |
--name="long-running" \ | |
--net="multihost" \ | |
--env="constraint:node==swarm-0" \ | |
busybox top | |
docker run -it --rm \ | |
--net="multihost" \ | |
--env="constraint:node==swarm-1" \ | |
busybox ping long-running | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment