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!
Docker network host, also known as Docker host networking, is a networking mode in which a Docker container shares its network namespace with the host machine. The application inside the container can be accessed using a port at the host's IP address (e.g., port 80).
By default, docker uses the bridge network driver, which connects the containers to a network separate from the host.
You'll understand the Docker container build and deploy tasks for a . NET application. The Docker platform uses the Docker engine to quickly build and package apps as Docker images. These images are written in the Dockerfile format to be deployed and run in a layered container.
When you connect an existing container to a different network using docker network connect , you can use the --ip or --ip6 flags on that command to specify the container's IP address on the additional network. In the same way, a container's hostname defaults to be the container's ID in Docker.
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:
$> 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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With