无法更新 WSL 发行版上的包

Sli*_*lim 7 linux ubuntu docker windows-subsystem-for-linux

我使用的是 Docker 桌面 v2.3.0,并在 Windows 10 Professional v1909 上启用了 WSL2。

我安装了 Ubuntu 20.04 发行版,我访问了它,当我运行时apt-get update

Err:1 http://archive.ubuntu.com/ubuntu focal InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Err:2 http://security.ubuntu.com/ubuntu focal-security InRelease
  Temporary failure resolving 'security.ubuntu.com'
Err:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Err:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Reading package lists... Done
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-updates/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-backports/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/focal-security/InRelease  Temporary failure resolving 'security.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.
Run Code Online (Sandbox Code Playgroud)

/etc/resolve.conf我尝试在使用后通过添加公司 DNS 服务器来更新ipconfig /all

然后我重新启动了 WSL 但不起作用。

我在 WSL Ubuntu (Linux 的 Windows 子系统) 上发现了类似的问题No internet connection并尝试了此解决方案,但没有一个为我解决了该问题。

我使用代理访问互联网,是否可以禁止 WSL 访问外部网络并应将其添加到 wsl 配置文件中?