Using dockers remote api in docker swarm
I have a microservice called “Creator”.
What that service does is use the docker remote api to create a new container with the microservice (“Calculator”) if needed.
Now I’m trying to get this working in Docker Swarm, and my question is about how I should be able to find the IP /DNS for the docker remote api in my swarm, from my service Creator.
An example would be that I’ve created a swarm cluster with 6 nodes (3 managers, 3 worker). I specify that I would like to have 1 instance of my Creator, and that instance get’s located on a worker node. On a worker node my service wouldn’t be able to query the swarm, to get the ip / dns to the remote api.
I could use a service discovery like consul and register a swarm manager here, and then query consul from my Creator service, but then I need to make sure consul is updated if a manager goes down.
I would hope there is a nice way of locating a manager built in to swarm. Do you know?