- https://github.com/progrium/docker-consul is used for running Consul
- All containers expose their ports through NAT (hence all have same IP but different ports)
docker run -d -h node1 -v /mnt:/data \
-p <public-IP>:8300:8300 \
-p <public-IP>:8301:8301 \
-p <public-IP>:8301:8301/udp \
-p <public-IP>:8302:8302 \
-p <public-IP>:8302:8302/udp \
-p <public-IP>:8400:8400 \
-p <public-IP>:8500:8500 \
-p 172.17.42.1:53:53/udp \
progrium/consul -server -advertise <public-IP> -bootstrap-expect 3
- Important is the option
-advertise <public-IP>
which tells Consul to use a different IP for service announcements (normally Consul would use the host IP which would be a private IP in this case as it is running inside a Docker container) - And encryption should be turned on for public reachable IPs