运行带有Docker Desktop 2.0.0.3 * 31259的Windows 18.09.2的Docker,尝试通过apt-get update更新Debian容器。
First I pull the latest images:
> docker pull debian
Using default tag: latest
latest: Pulling from library/debian
5ae19949497e: Pull complete
Digest: sha256:903779f30a7ee46937bfb21406f125d5fdace4178074e1cc71c49039ebf7f48f
Status: Downloaded newer image for debian:latest
> docker run -d -ti --name d1 debian
d1fce4047033d6321740f98315b2ec050ca946c835625927065d413f21fd216d
> docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d1fce4047033 debian "bash" 2 seconds ago Up 1 second d1
然后我连接到容器并尝试进行更新:
$ winpty docker exec -ti d1 bash
root@d1fce4047033:/# uname -a
Linux d1fce4047033 4.9.125-linuxkit #1 SMP Fri Sep 7 08:20:28 UTC 2018 x86_64 GNU/Linux
root@d1fce4047033:/# apt-get clean
root@d1fce4047033:/# apt-get update
Err:1 http://security.debian.org/debian-security buster/updates InRelease
503 Service Unavailable [IP: 212.211.132.250 80]
Err:2 http://deb.debian.org/debian buster InRelease
503 Service Unavailable [IP: 5.153.231.4 80]
Err:3 http://deb.debian.org/debian buster-updates InRelease
503 Service Unavailable [IP: 5.153.231.4 80]
Reading package lists... Done
W: Failed to fetch http://deb.debian.org/debian/dists/buster/InRelease 503 Service Unavailable [IP: 5.153.231.4 80]
W: Failed to fetch http://security.debian.org/debian-security/dists/buster/updates/InRelease 503 Service Unavailable [IP: 212.211.132.250 80]
W: Failed to fetch http://deb.debian.org/debian/dists/buster-updates/InRelease 503 Service Unavailable [IP: 5.153.231.4 80]
W: Some index files failed to download. They have been ignored, or old ones used instead.
root@d1fce4047033:/# ping 212.211.132.250
PING 212.211.132.250 (212.211.132.250) 56(84) bytes of data.
64 bytes from 212.211.132.250: icmp_seq=1 ttl=37 time=18.5 ms
^C
--- 212.211.132.250 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 6ms
rtt min/avg/max/mdev = 18.406/19.176/20.597/1.012 ms
root@d1fce4047033:/# wget
bash: wget: command not found
root@d1fce4047033:/# curl
bash: curl: command not found
如您所见,更新失败,但是我可以连接互联网。尝试了几次,但没有运气。 因为这与尝试拉Ubuntu或其他东西时的行为相同,所以我认为背后没有简单的原因。 我已经通过wget测试了在busybox上下载这些文件之一的方法,并且可以正常工作。另外,当我尝试通过浏览器下载网站时。那么这里发生了什么?
答案 0 :(得分:0)
这可能是防火墙规则,阻止了来自容器内部的请求。有时,防火墙被配置为接受ICMP请求(ping)但阻止TCP / UPD通信。也许您可以检查主机上iptables -L
的结果。
答案 1 :(得分:0)
丑陋的解决方法是通过 sed