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:

  • How should I Accomplish a Better Docker Workflow?
  • Docker-compose and Docker-swarm
  • “AH01071: Got error 'Unable to open primary script”: Container permissions or Symfony3 issue?
  • Docker - Use IP instead of --link for communication
  • Installing sensu, sensu-dashboard does not install
  • AWS EC2 Task/Service container with java command in the container definitions
  • 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)

  • Install packages from the Debian Snapshot Archives repo?
  • Push docker image to amazon ecs repository
  • How to use docker in windows 7
  • Why does running some docker images must add a command?
  • DOCKER for setting up BitBucket
  • Rails 5 Regular Tasks Without Cron
  • 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.