dockerbuild设没有networking,但docker运行

如果我想构build我的Dockerfile,它不能连接到networking或至lessDNS:

Sending build context to Docker daemon 15.95 MB Sending build context to Docker daemon Step 0 : FROM ruby ---> eeb85dfaa855 Step 1 : RUN apt-get update -qq && apt-get install -y build-essential libpq-dev ---> Running in ec8cbd41bcff W: Failed to fetch http://httpredir.debian.org/debian/dists/jessie/InRelease W: Failed to fetch http://httpredir.debian.org/debian/dists/jessie-updates/InRelease W: Failed to fetch http://security.debian.org/dists/jessie/updates/InRelease W: Failed to fetch http://httpredir.debian.org/debian/dists/jessie/Release.gpg Could not resolve 'httpredir.debian.org' W: Failed to fetch http://httpredir.debian.org/debian/dists/jessie-updates/Release.gpg Could not resolve 'httpredir.debian.org' W: Failed to fetch http://security.debian.org/dists/jessie/updates/Release.gpg Could not resolve 'security.debian.org' W: Some index files failed to download. They have been ignored, or old ones used instead. Reading package lists... Building dependency tree... Reading state information... E: Unable to locate package build-essential INFO[0001] The command "/bin/sh -c apt-get update -qq && apt-get install -y build-essential libpq-dev" returned a non-zero code: 100 

但是,如果我通过docker run完全相同的命令它的作品:

 docker run --name="test" ruby /bin/sh -c 'apt-get update -qq && apt-get install -y build-essential libpq-dev' 

有没有人有一个想法,为什么docker build不起作用? 我已经尝试了所有在StackOverflow上的DNS相关的tipps,就像起始docker使用–dns 8.8.8.8等

提前致谢

我的docker构build也失败,而尝试运行apt-get upgrade与完全相同的错误。 我在Mac OSX上使用docker-machine,一个简单的docker-machine restart default解决了这个问题。 不知道最初是怎么造成的。

Docker肯定似乎有一些networking问题。 我设法解决这个问题

systemctl restart docker

…这基本上只是Debian 8中的unix级别的“restart-the-daemon”命令。

我有类似的问题。 但是,当我运行AWS Linux,我没有systemctl。 我解决了使用:

 sudo service docker restart 

我有一个树莓完全相同的问题。

启动/停止服务没有帮助,但重新安装包( dpkg -i docker-hypriot_1.10.3-1_armhf.deb && service docker start在我的情况下)立即解决了这种情况: apt-get updatepipe理解决和达到服务器。

安装过程中必须执行一些操作。

上述报告行为的另一个案例 – 这次从jenkinsbuild立一个docker图像:

步骤3:运行apt-get update && apt-get install -y curl libapache2-mod-proxy-html —>在ea7aca5dea9b中运行

错误http://security.debian.org jessie /更新InRelease

错误http://security.debian.org jessie /更新Release.gpg

无法解决'security.debian.org'错误http://httpredir.debian.org jessie InRelease […]

在我的情况下,事实certificate,DNS不能从容器内到达 – 但仍然从docker主机! (容器parsing器configuration是好的(!))重新启动docker机(完全重新启动 – “docker.service重新启动”没有做到这一点),它一直在工作。 所以我的一个活动(或我的一个同事)一定已经打破了dockernetworking呢! 也许一些firewalld修改活动?

我仍然在调查,因为我不确定哪个活动可能会损坏dockernetworking,然后…

今天也面临同样的问题。 我的解决方法是重新启动你的docker机器。 在我的情况下,它在VirtualBox

一旦你closures它,然后重新启动机器, http://security.debian.org //security.debian.org似乎解决了。

希望这可以帮助。

几个build议,不知道他们是否会工作。 你可以改变...apt-get install -y......apt-get install -yqq...

此外,你想要build立的形象改变了吗?