Update on Getting started with Docker Version 1.12.1
Few things changed after previous post. Certainly the way you deploy docker swarm mode as well few things on the networking side of things.
I therefore share this example script to quickly get started with a new setup and play around.
#!/bin/bash
docker-machine ls
#create 1st manager node
docker-machine create -d virtualbox manager1
eval $(docker-machine env manager1)
docker swarm init --advertise-addr $(docker-machine ip manager1)
docker swarm join-token -q manager > manager-token.txt
docker swarm join-token -q worker > worker-token.txt
#create 2nd and 3th manager nodes
for N in 2 3; do
docker-machine create -d virtualbox manager$N
eval $(docker-machine env manager$N)
docker swarm join --token $(cat manager-token.txt) $(docker-machine ip manager1)
done
#create 4 to 7 worker nodes
for N in `seq 1 4`; do
docker-machine create -d virtualbox worker$N
eval $(docker-machine env worker$N)
docker swarm join --token $(cat worker-token.txt) $(docker-machine ip manager1)
done
eval $(docker-machine env manager1)
docker service create --name nginx -p 80:80 --replicas 20 nginx
docker service create --name nginx2 --constraint node.role==worker \
-p 8080:80 \
--replicas 5 nginx
Please note that it is not possible anymore to connect "non"-service containers to the overlay networks anymore as indicated in the previous post.
A trick to test the overlay network can be to spin up a service in which you install your debugging tools or to link a container as follows for example:
docker run -it --net=container:id_of_a_service_container xxradar/hackon
No comments:
Post a Comment