You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Install Docker and Consul on both hosts
sudo apt-get install -y unzip wget curl
wget -qO- https://experimental.docker.com/ | sh
cd /usr/bin
sudo wget https://dl.bintray.com/mitchellh/consul/0.5.2_linux_amd64.zip
sudo unzip *.zip
sudo rm *.zip
docker -v
consul --version
# On host 1
ip a (get the ip address)
consul agent -server -bootstrap -data-dir /tmp/consul -bind=10.254.101.21 &
sudo /usr/bin/docker -d --kv-store=consul:localhost:8500 --label=com.docker.network.driver.overlay.bind_interface=eth1
# Ohost 2
ip a (get the ip address)
consul agent -data-dir /tmp/consul -bind=10.254.101.22 &
consul join 10.254.101.21
sudo /usr/bin/docker -d --kv-store=consul:localhost:8500 --label=com.docker.network.driver.overlay.bind_interface=eth1 --label=com.docker.network.driver.overlay.neighbor_ip=10.254.101.21
On Machine 1
docker network create -d overlay prod
docker network ls
docker network info prod
docker service publish db1.prod
cid=$(docker run -itd ubuntu)
docker service attach $cid db1.prod
On Machine 2
docker network ls
docker network info prod
docker service publish db2.prod
cid=$(docker run -itd ubuntu)
docker service attach $cid db2.prod