Raspberry Pi Swarm with overlay network
# Create a RPi with consul running on it | |
docker-machine-hypriot create -d hypriot --hypriot-ip-address=192.168.1.3 swl-consul | |
docker $(docker-machine config swl-consul) run -d --restart=always -p 8500:8500 -h consul nimblestratus/rpi-consul -server -bootstrap | |
# Create a RPi swarm with consul discovery | |
docker-machine-hypriot create -d hypriot --hypriot-ip-address=192.168.1.4 --swarm --swarm-master --swarm-discovery="consul://$(docker-machine ip swl-consul):8500" --engine-opt="cluster-store=consul://$(docker-machine ip swl-consul):8500" --engine-opt="cluster-advertise=eth0:0" swl-demo0 | |
docker-machine-hypriot create -d hypriot --hypriot-ip-address=192.168.1.5 --swarm --swarm-discovery="consul://$(docker-machine ip swl-consul):8500" --engine-opt="cluster-store=consul://$(docker-machine ip swl-consul):8500" --engine-opt="cluster-advertise=eth0:0" --engine-label "storage=ssd" swl-demo1 | |
# Connect to the RPi swarm | |
eval $(docker-machine env --swarm swl-demo0) | |
# You may check your RPi swarm | |
docker info | |
# Create an overlay network | |
docker network create -d overlay my-net | |
# You may check your networks | |
docker network ls | |
# Try it out | |
docker run -itd --name=web --net=my-net --env="constraint:node==swl-demo0" hypriot/rpi-nano-httpd | |
docker run -it --rm --net=my-net --env="contraint:node=swl-demo1" hypriot/armhf-busybox wget -O- http://web |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
This is a demo from @chanezon VirtualBox demo https://github.com/chanezon/docker-tips/blob/master/orchestration-networking/swarm-local.sh ported to three Raspberry Pis running HypriotOS "Hector".
I just ran these commands with the Hypriot docker-machine Mac binary which is still version 0.4.1, but plays well with Docker 1.9 and Swarm 1.0