Last active
November 15, 2015 23:14
-
-
Save StefanScherer/c3890d8277455e6c257d to your computer and use it in GitHub Desktop.
Raspberry Pi Swarm with overlay network
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
# 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 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