When we run a single docker container, we can specify --dns using which we can have additional dns entries required by the app.
Eg: docker run -dit --dns 172.17.0.1 imageid
in which case dnsmasq was running on 172.17.0.1
We are currently moving to docker swarms to get auto scaling and other features, however there is no option to specify --dns , is there any easy workaround?
From what I know, it is not possible to provide dns directly to your services, whether you are using docker service create or using the docker remote API.
However, there is an option on the docker daemon that lets you modify the dns server to be used for the container the daemon launch. So, if the dns server is the same for all of your container, I'd advise you to edit your docker daemon options to add the --dns
option, to specify your server
If only some of your services requires using a specific dns server, I'd advise you to set up one of your node's daemon options to use this dns and use the --contraint
option of docker service create