问题描述
要将其他选项传递给 docker build
,您可以在 / etc中指定
,但是--net不可用。在构建容器时可以使用主机的网络堆栈吗? DOCKER_OPTS
/ default / docker
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?
我正在运行Docker版本1.3.2,构建39fa2fa。
I'm running Docker version 1.3.2, build 39fa2fa.
谢谢!
推荐答案
要解决问题,请配置docker守护程序以使用您的公司DNS服务器。例如,如果您的resolv.conf具有以下配置:
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
更改/ etc / default / docker以包含以下内容:
Change /etc/default/docker to contain the following:
DOCKER_OPTS="--dns 10.123.123.123"
并重新启动docker守护程序:
And restart docker daemon with:
sudo service docker restart
现在,容器可以访问在构建操作期间到内部网。
Now, containers will have access to the intranet during the build operation.
相关答案:
这篇关于通过--net =主机到码头构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!