Search code examples
dockerdns

Set DNS options during docker build


Due to local network configuration I have to add --dns and --dns-search options to my docker run commands like so:

docker run --dns XX.XX.1.1 --dns-search companydomain -t mycontainer

However docker build doesn't have the same options. Is there a way to specify these options during build?


Solution

  • The docker build uses the DNS settings of the docker engine running on the host. See my answer here for steps to update the DNS settings on the engine.