We need a global docker network in order to communicate between docker-compose setups on different hosts
https://www.consul.io/intro/getting-started/install.html
Edit /etc/default/docker
DOCKER_OPTS="-H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock --cluster-advertise <Network Interface of Bridged Network>:2375 --cluster-store consul://consul_host:8500"
Edit /lib/systemd/system/docker.service
Add EnvironmentFile line, then add $DOCKER_OPTS to the next line:
EnvironmentFile=/etc/default/docker
ExecStart= ... $DOCKER_OPTS -H fd://
Restart docker.service
sudo service docker restart
docker network create -d overlay --subnet=20.1.0.0/16 test_net
All hosts are able to see that network, so you can run next command on each host.
docker run -dti --net test_net ubuntu
Hey, never is late xd.
If you are not exposing your docker node to internet it should be safe.