How to start a consul client running in a docker container?

Update: I overlooked the progrium/consul page on dockerhub which had the solution to my question.

Question:

  • Docker for Mac Container to Host Networking - Consul Health Checks Connection Refused
  • Consul watch with critical consul checks
  • How to pass parameters while creating consul client agent inside a Docker container?
  • cannot ping container in another host with docker consul
  • Consul Empty reply from server
  • Ubuntu docker swarm error “docker: Cannot connect to the Docker daemon. Is the docker daemon running on this host?.”
  • So I am running consul in the progrium/consul container. I am running 3 servers joined together and would like to add some consul clients. However I have not been able to find any guides that detail how to start consul clients using the progrium/consul container. Here is my current attempt to start a client:

    Note that $CLIENT_IP_ADDR is my clients IP address and $CONSUL_SERVER0, $CONSUL_SERVER1 and $CONSUL_SERVER2 are the IP addresses of my consul servers.

    docker run -d -h client0 --name client0 -v /mnt:/data \
    -p $CLIENT_IP_ADDR:8300:8300 \
    -p $CLIENT_IP_ADDR:8301:8301 \
    -p $CLIENT_IP_ADDR:8301:8301/udp \
    -p $CLIENT_IP_ADDR:8302:8302 \
    -p $CLIENT_IP_ADDR:8302:8302/udp \
    -p $CLIENT_IP_ADDR:8400:8400 \
    -p $CLIENT_IP_ADDR:8500:8500 \
    -p 172.17.0.1:53:53/udp \
    progrium/consul -client -advertise $CLIENT_IP_ADDR \
    -join $CONSUL_SERVER0 -join $CONSUL_SERVER1 -join $CONSUL_SERVER2
    

    Here are the error messages I get when I check the logs for my container:

    myUserName@myHostName:~$ docker logs client0
    ==> WARNING: It is highly recommended to set GOMAXPROCS higher than 1
    ==> Starting Consul agent...
    ==> Error starting RPC listener: listen tcp $CLIENT_IP_ADDR:8400: bind: cannot assign requested address
    

  • What is location of images pulled from Docker Hub via Docker for Mac
  • Running openshift origin on mac 10.11.6 with docker version 1.12.0
  • Accessing docker container from iOS Simulator
  • etcd api on CoreOS - setting ip address configurations remotely
  • Python3 utf8 codecs not decoding as expected in Docker ubuntu:trusty
  • run symfony2 app with docker [File not found.]
  • One Solution collect form web for “How to start a consul client running in a docker container?”

    I think the answer was just to remove the -client tag from my container:

    docker run -d -h client0 --name client0 -v /mnt:/data \
    -p $CLIENT_IP_ADDR:8300:8300 \
    -p $CLIENT_IP_ADDR:8301:8301 \
    -p $CLIENT_IP_ADDR:8301:8301/udp \
    -p $CLIENT_IP_ADDR:8302:8302 \
    -p $CLIENT_IP_ADDR:8302:8302/udp \
    -p $CLIENT_IP_ADDR:8400:8400 \
    -p $CLIENT_IP_ADDR:8500:8500 \
    -p 172.17.0.1:53:53/udp \
    progrium/consul -advertise $CLIENT_IP_ADDR \
    -join $CONSUL_SERVER0 -join $CONSUL_SERVER1 -join $CONSUL_SERVER2
    

    Apparently its the default mode of this container https://hub.docker.com/r/progrium/consul/. I think its running in client mode because my client0 node does not appear under the consul service. Only my 3 consul servers appear there.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.