scmrus
6/4/2016 - 11:58 AM

Run Consul in Docker container

Run Consul in Docker container

Assumptions

Consul Command

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