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!
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!
Try
--network
instead of--net
. It is new in the 1.25 API and sets the networking mode for the RUN instructions.To solve the problem, configure docker daemon to use the your company DNS server. For instance, if your resolv.conf has the following configuration:
Change /etc/default/docker to contain the following:
And restart docker daemon with:
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