通过--net =主机到码头构建 [英] Pass --net=host to docker build

查看:88
本文介绍了通过--net =主机到码头构建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要将其他选项传递给 docker build ,您可以在 / etc中指定 DOCKER_OPTS / default / docker ,但是--net不可用。在构建容器时可以使用主机的网络堆栈吗?

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.

相关答案: Dockerfile:Docker build无法下载软件包:centos-> yum,debian / ubuntu-> apt-get behind intranet

这篇关于通过--net =主机到码头构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆