To pass other options to docker build
, you can speciy DOCKER_OPTS
in /etc/default/docker
, however --net is not available. Is it possible to use the host's networking stack when building a container?
I'm running Docker version 1.3.2, build 39fa2fa.
Thanks!
To solve the problem, configure docker daemon to use the your company DNS server. For instance, if your resolv.conf has the following configuration:
$> cat /etc/resolv.conf
domain mycompany
search mycompany
nameserver 10.123.123.123
Change /etc/default/docker to contain the following:
DOCKER_OPTS="--dns 10.123.123.123"
And restart docker daemon with:
sudo service docker restart
Now, containers will have access to the intranet during the build operation.
Related answer: Dockerfile: Docker build can't download packages: centos->yum, debian/ubuntu->apt-get behind intranet
Try --network
instead of --net
. It is new in the 1.25 API and sets the networking mode for the RUN instructions.
From the newest versions (currently docker ce v17) it is possible to add --network=host to your docker build command which is similar to --net=host when using docker run!