How I can add new nameserver in /etc/resolv.conf
(dockerfile)?
On my dockerfile I use:
FROM ubuntu:14.04
RUN echo \"nameserver 10.111.122.1
So, one of the ways you can add new DNS information to your container's build process is by adding some startup options to your Docker daemon. The documentation for that process reveals that the option you'll use is --dns
. The location of your configuration file depends on your specific distro. On my Linux Mint machine, the file is in /etc/default/docker
. On Linux Mint, look for the DOCKER_OPTS=
line, and add the appropriate --dns=x.x.x.x
entries to that line.
For example, if you want to use Google's DNS, you should change that line to look like this:
DOCKER_OPTS="--dns=8.8.4.4 --dns=8.8.8.8"
Additionally, in the absense of --dns
or --dns-search
startup options, Docker will use the /etc/resolv.conf
of the host it's running on instead.