Docker无法取得http://deb.debian.org/debian/dists/jessie/InRelease

当我试图在我的房子里build立我的docker图像时,发现了一些奇怪的问题,尽pipe我不确定它是否与浏览器或networking问题相关。

所以这就是我得到的。 我试图在我的Dockerfile中运行这个命令。

RUN apt-get update -qq && \ apt-get install -y build-essential \ libpq-dev \ postgresql-client 

等了一会儿,有点过程输出这样的东西。

 W: Failed to fetch http://deb.debian.org/debian/dists/jessie/InRelease W: Failed to fetch http://deb.debian.org/debian/dists/jessie-updates/InRelease W: Failed to fetch http://security.debian.org/dists/jessie/updates/InRelease W: Failed to fetch http://deb.debian.org/debian/dists/jessie/Release.gpg Temporary failure resolving 'deb.debian.org' W: Failed to fetch http://security.debian.org/dists/jessie/updates/Release.gpg Temporary failure resolving 'security.debian.org' W: Failed to fetch http://deb.debian.org/debian/dists/jessie-updates/Release.gpg Temporary failure resolving 'deb.debian.org' W: Some index files failed to download. They have been ignored, or old ones used instead. 

奇怪的是,如果我在我的办公室networking中尝试这个,这不会发生。 然后,如果我尝试绑定到我的手机数据networking,这也不会发生。

我试图在浏览器中打开http://deb.debian.org/debian/dists/jessie/InRelease ,它显示404.我尝试使用Tor浏览器通过几个networking,它也显示404。

docker镜像基于ruby:2.3.1

UPDATE

我试图使用由我的房子提供商203.142.82.222提供的DNS。

 sudo docker run --dns 203.142.82.222 busybox nslookup google.com 

这解决了

 Server: 203.142.82.222 Address 1: 203.142.82.222 dns-cache1.biz.net.id Name: google.com Address 1: 2404:6800:4003:808::200e sin10s07-in-x0e.1e100.net Address 2: 117.102.117.245 Address 3: 117.102.117.251 Address 4: 117.102.117.212 

但后来我改成了/etc/default/docker文件并添加了这个。

 DOCKER_OPTS="--dns 203.142.82.222 --dns 203.142.84.222" 

重新启动docker sudo service docker restart ,我再次尝试,但它仍然无法正常工作。

 sudo service docker restart sudo docker run busybox nslookup google.com Server: 8.8.8.8 Address 1: 8.8.8.8 nslookup: can't resolve 'google.com' 

/ etc / default / docker文件仅在使用“upstart”和“SysVInit”的系统上使用,而不是在使用systemd的系统上使用。

这也是在文件顶部提到的: https : //github.com/docker/docker/blob/44fe8cbbd174b5d85d4a063ed270f6b9d2279b70/contrib/init/sysvinit-debian/docker.default#L1

所以,不要使用/ etc / default / docker。 它只被新贵使用,这是自16.04以来Ubuntu没有使用的。

使用/etc/docker/daemon.json,这里logging: https ://docs.docker.com/engine/reference/commandline/dockerd/#/linux-configuration-file

在那里你可以configuration你的DNS