Docker Community Forums

Share and learn in the Docker community.

DNS configuration for CentOS


(AstonJ) #1

Hi, I’m very new to Docker so please be gentle.

I recently put a Discourse instance on my server with Docker. I am using HAProxy to divert the Discourse domain to the Docker container, and everything else as normal to Apache.

Docker was having issues connecting to the internet though, and this thread suggests uncommenting this line:

DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4"

in /etc/default/docker a file that doesn’t exist on my CentOS 6.5 install. But this one does /etc/sysconfig/docker so I add the line to the bottom of this file, restart Docker with service docker restart and it worked!

But then at some point (since yesterday) it just stopped working, and restarting docker again gets it working.

I’m worried there’s some reason why this isn’t sticking, does anyone know what the correct configuration should be?

My /etc/sysconfig/docker now reads like the below - I moved the Docker_opts line just below the cert_path (it was originally at the bottom of the file)

#
# Other arguments to pass to the docker daemon process
# These will be parsed by the sysv initscript and appended
# to the arguments list passed to docker -d

other_args=
DOCKER_CERT_PATH=/etc/docker
DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4"

# Location used for temporary files, such as those created by
# # docker load and build operations. Default is /var/lib/docker/tmp
# # Can be overriden by setting the following environment variable.
# # DOCKER_TMPDIR=/var/tmp

Any ideas what’s going on or how I can sort this out please?


(AstonJ) #2

Can anyone help with this please?

Since my last post I upgraded to the latest version of Docker and while everything seemed ok for a while it has started to happen again. Restarting Docker has fixed it again but I expect this is only temporary.

Can anyone think of a more permanent solution?


(Dmitry Sandalov) #3

/etc/sysconfig/docker

other_args="--dns 192.135.82.36 --dns 192.135.82.52"
export HTTP_PROXY="http://proxy.company.com:80"
export http_proxy="http://proxy.company.com:80"
export HTTPS_PROXY="http://proxy.company.com:80"
export https_proxy="http://proxy.company.com:80"

sudo service docker restart