Skip to content

Instantly share code, notes, and snippets.

@geku
Last active June 4, 2016 11:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save geku/af2c509035da71249a8d to your computer and use it in GitHub Desktop.
Save geku/af2c509035da71249a8d to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment