Docker容器中apt-get无法解析URL但wget可正常解析的问题求助
Docker容器中apt-get无法解析URL但wget可正常解析的问题求助
大家好,我遇到了一个特别奇怪的问题,想请教下各位:
我在尝试构建镜像时,apt-get update总是失败,提示无法解析域名,但容器的网络明明正常,DNS配置也没问题,甚至用wget拉取同一个URL的文件都完全正常!
以下是我的终端操作和输出:
❯ docker run -i -t python /bin/bash root@e0264555b919:/# apt-get update Err:1 http://deb.debian.org/debian bullseye InRelease Temporary failure resolving 'deb.debian.org' Err:2 http://deb.debian.org/debian-security bullseye-security InRelease Temporary failure resolving 'deb.debian.org' Err:3 http://deb.debian.org/debian bullseye-updates InRelease Temporary failure resolving 'deb.debian.org' Reading package lists... Done W: Failed to fetch http://deb.debian.org/debian/dists/bullseye/InRelease Temporary failure resolving 'deb.debian.org' W: Failed to fetch http://deb.debian.org/debian-security/dists/bullseye-security/InRelease Temporary failure resolving 'deb.debian.org' W: Failed to fetch http://deb.debian.org/debian/dists/bullseye-updates/InRelease Temporary failure resolving 'deb.debian.org' W: Some index files failed to download. They have been ignored, or old ones used instead. root@e0264555b919:/# wget http://deb.debian.org/debian/dists/bullseye-updates/InRelease --2023-01-07 11:50:33-- http://deb.debian.org/debian/dists/bullseye-updates/InRelease Resolving deb.debian.org (deb.debian.org)... 151.101.62.132, 2a04:4e42:f::644 Connecting to deb.debian.org (deb.debian.org)|151.101.62.132|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 44066 (43K) Saving to: ‘InRelease’ InRelease 100%[==========================================>] 43.03K --.-KB/s in 0.01s 2023-01-07 11:50:33 (3.84 MB/s) - ‘InRelease’ saved [44066/44066] root@e0264555b919:/# head InRelease -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Origin: Debian Label: Debian Suite: stable-updates Version: 11-updates Codename: bullseye-updates Date: Sat, 07 Jan 2023 08:40:57 UTC Valid-Until: Sat, 14 Jan 2023 08:40:57 UTC root@e0264555b919:/# cat /etc/resolv.conf nameserver 8.8.8.8 nameserver 1.1.1.1 root@e0264555b919:/#
有没有大佬知道这到底是怎么回事?我试了好几个基于Debian的镜像,都是同样的问题!
备注:内容来源于stack exchange,提问作者AntouanK
相关产品推荐
相关产品推荐

