vpram86
vpram86

Reputation: 6000

Docker swarm service resolution with same name as another host

I have a weird situation where one of the service name, let's say 'myservice' in docker swarm shares the name with an actual host in my network. Sometimes the resolution of 'myservice' picks up that host IP and things fail since its not related to anything I am running. Is there a way to give 'myservice' in a fashion that forces docker to resolve it with its own services? Is that 'tasks.myservice' or something better? Docker swarm CE 17.09 is the version in use

Upvotes: 1

Views: 782

Answers (1)

Bret Fisher
Bret Fisher

Reputation: 8596

The easiest thing to do is change your Swarm service name... or give it a custom name that's different from service name to use, with --hostname option.

I would think the docker internal DNS would always resolve bridge/overlay network hostnames first before searching external resolvers.

Note that any containers on docker virtual networks will never resolve the the container hostname on a different bridge/overlay network, so in those cases they would correctly resolve the external DNS.

Upvotes: 2

Related Questions