【发布时间】:2017-10-20 04:25:30
【问题描述】:
我在尝试在家中构建 docker 映像时发现了一些奇怪的问题,但我不确定它是与浏览器相关还是只是网络问题。
这就是我得到的。我试图在我的 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.
奇怪的是,如果我在我的办公室网络中尝试过这个,这不会发生。然后,如果我尝试绑定到我的手机数据网络,这也不会发生。
我尝试在浏览器中打开http://deb.debian.org/debian/dists/jessie/InRelease,它显示404。我尝试通过多个网络使用Tor浏览器,它也显示404。
docker 镜像基于ruby:2.3.1。
更新
我尝试使用我的房屋提供商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"
重启dockersudo 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'
【问题讨论】:
-
@KrisRoofe 非常感谢!我刚刚尝试过,但仍然无法正常工作。问题已更新。