How to specify docker image's DNS?

Now I have a lot of docker containers running on my host machine, and inside the containers, dns-look-up is very slow. So I want to change the containers’ DNS.

I’ve known two possible ways:

  • Accessing swarm-master via api
  • Bind docker container to IP on OSX
  • Error using Poseidon: Poseidon::Errors::UnableToFetchMetadata
  • udevadm does not show all attributes inside a docker container
  • Dockerize application parts of an Axon/JGroups application?
  • java tomcat let's encrypt with docker
  • 1) use command-line argument ‘-dns’
    2) modify /etc/default/docker -> DOCKER_OPTS and restart docker daemon

    The above two ways force me to either change my docker run command, or restart daemon which will stop all currently running containers. I cannot accept these.

    So, is there any way else to change a docker image’s DNS? (re-run an image is acceptable)

  • Using Docker with nodejs with node-gyp dependencies
  • How to delete logs in IBM Containers service (BlueMix)
  • How to run Redis on Docker using docker-compose.yml?
  • 403 Forbidden - Nginx, Docker & Windows
  • Tracks stops working when volume is specified
  • Unable to run cassandra docker on Mesos
  • One Solution collect form web for “How to specify docker image's DNS?”

    You can write to /etc/resolv.conf inside a container. Perhaps EXEC a script that does that and then runs the real program.

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