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:

  • Strong-PM in Docker Container App Connect to Host MongoD
  • WordPress can't see linked mysql container on IBM Bluemix with Docker compose
  • cannot pm2 list in docker containers
  • Grafana + InfluxDB configuration
  • Push selected files from service repository to Consul
  • Playframework: activator dist taking too long from within docker container
  • 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)

  • How to get the output from docker run -i
  • How to serve static files from a Dockerized Python web app?
  • How to deploy consul using Docker 1.12 swarm mode
  • Is it possible to combine and push multicontainer/images docker app to docker-hub? if yes how?
  • Run script in background inside docker container from host
  • CentOS 6.7 Connection Issues with Docker behind a firewall
  • 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.