Docker Community Forums

Share and learn in the Docker community.

Docker Swarm and Consul Integration


(Slynch00) #1

I have a docker swarm cluster working with 3 managers and 3 workers. Deploying services is working correctly on the ingress network. I am trying to integrate registration of the containers with a consul server. I have tried a couple of different approaches and haven’t been able to figure out how to get this to work. I have tried using a registrator container running on the worker I am testing with configured to communicate to with a consul server (not running as a container).

When I use docker run to start a container, the container registers successfully with the consul server from the worker with registrator running.
When I use docker swarm to deploy a docker service, the container successfully starts on the worker with registrator, but does not register with consul.
When I use docker swarm to deploy without registrator it also does not register with consul

I am not sure if I am having a communication problem from the ingress network or if there is another way I should be approaching this. An inspect of the manager node seems to identify the configuration for the consul server successfully:

    "SwarmOptions": {
        "IsSwarm": true,
        "Address": "",
        "Discovery": "consul://10.1.1.1:8500",
        "Agent": true,
        "Master": true,
        "Host": "tcp://0.0.0.0:3376",
        "Image": "swarm:latest",
        "Strategy": "spread",
        "Heartbeat": 0,
        "Overcommit": 0,
        "ArbitraryFlags": [],
        "ArbitraryJoinFlags": [],
        "Env": null,
        "IsExperimental": false

Does anyone have a successful integration with docker swarm and consul for service registration working?