Docker for AWS Workspaces (Linux) 似乎没有互联网?

Lew*_*uce 4 amazon-web-services docker amazon-workspaces

我正在 AWS Workspaces 中设置新的开发环境,我注意到当我运行 时docker build,出现以下错误:

 ---> Running in d18733d53c16
W: Failed to fetch http://deb.debian.org/debian/dists/buster/InRelease  Temporary failure resolving 'deb.debian.org'
W: Failed to fetch http://security.debian.org/debian-security/dists/buster/updates/InRelease  Temporary failure resolving 'security.debian.org'
W: Failed to fetch http://deb.debian.org/debian/dists/buster-updates/InRelease  Temporary failure resolving 'deb.debian.org'
W: Some index files failed to download. They have been ignored, or old ones used instead.
Run Code Online (Sandbox Code Playgroud)

Reddit 上有人提到这是一个已知问题,但 AWS 文档似乎没有提到这个问题,而且我在网上找不到更多相关信息。

它只是一个标准的 Docker 文件,已经使用了大约一年,没有出现任何问题。这似乎正在发生在适用于 Linux 的 AWS Workspaces 中。

Gui*_*ros 8

使用桥接网络的 docker 镜像似乎无法访问主机的 DNS。我怀疑 AWS 工作区 DNS 正在进行一些过滤。

docker run --rm busybox nslookup google.com
;; connection timed out; no servers could be reached
Run Code Online (Sandbox Code Playgroud)

使用主机网络它可以工作。

docker run --rm --network=host busybox nslookup google.com
Server:     10.2.8.238
Address:    10.2.8.238:53

Non-authoritative answer:
Name:   google.com
Address: 2a00:1450:4001:828::200
Run Code Online (Sandbox Code Playgroud)

如果您需要使用桥接网络,那么我建议强制 docker 使用 Google 的 DNS 作为解决方法

cat /etc/docker/daemon.json 
{
    "dns":["1.1.1.1","8.8.8.8"]
}
Run Code Online (Sandbox Code Playgroud)