Fix Docker DNS problem

My school blocks DNS request packets to any host except school’s DNS server.
But many Docker image uses and as DNS server.

append --dns a.b.c.d to docker run command fix this problem temporarilly. But this option cannot be used on build command. So I have to use another solution.

Append --dns a.b.c.d to docker daemon command.

# /etc/default/docker
DOCKER_OPTS="--dns a.b.c.d"

Update – 2017-08-20

Just use /etc/docker/daemon.json to do this:

  "dns": ["a.b.c.d"]


I'm a hacker, I want to improve life.

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.