我在CentOS 8上安装了docker。CentOS不再是Docker。当我输入docker build -t project .
时,出现以下错误消息:
Err:1 http://deb.debian.org/debian testing InRelease
Temporary failure resolving 'deb.debian.org'
Err:2 http://http.debian.net/debian sid InRelease
Temporary failure resolving 'http.debian.net'
Reading package lists...
W: Failed to fetch http://deb.debian.org/debian/dists/testing/InRelease Temporary failure resolving 'deb.debian.org'
W: Failed to fetch http://http.debian.net/debian/dists/sid/InRelease Temporary failure resolving 'http.debian.net'
W: Some index files failed to download. They have been ignored, or old ones used instead.
Reading package lists...
E: The value 'testing' is invalid for APT::Default-Release as such a release is not available in the sources
The command '/bin/sh -c apt-get update && apt-get install -yq --no-install-recommends groff && rm -rf /var/lib/apt/lists/*' returned a non-zero code: 100
我在/etc/resolv.conf nameserver 8.8.8.8
中尝试过
答案 0 :(得分:1)
事实上,当您进行docker build时,docker internal将为您设置临时构建容器,因此它仍与容器的dns相关。
默认情况下,docker将使用/etc/resolv.conf
文件中本地定义的dns,但如果找不到,则您也可能有机会覆盖它。
您应该创建具有以下内容的下一个文件来设置DNS:
/etc/docker/daemon.json:
{
"dns": ["your_dns_ip"]
}
最后,重新启动您的泊坞窗以使其生效。详细信息参考Fix Docker's networking DNS config。
另外,请确保使用可行的dns,并确保8.8.8.8
确实可以在您所在的国家/地区使用。