作为 LXD 容器运行的 Centos 8 无法安装软件包:yum 无法连接到 mirrorlist.centos.org 端口 80:连接超时

作为 LXD 容器运行的 Centos 8 无法安装软件包:yum 无法连接到 mirrorlist.centos.org 端口 80:连接超时

在 Ubuntu 下,我创建了一个 Centos 8 LXD 容器:

lxc launch images:centos/8 centoscontainer

然后,我使用 登录到容器lxc exec centoscontainer /bin/bash

我是root,我可以正常访问网络:

# ping mirrorlist.centos.org
PING mirrorlist.centos.org (147.75.69.225) 56(84) bytes of data.
64 bytes from packet04.centos.org (147.75.69.225): icmp_seq=1 ttl=43 time=213 ms
64 bytes from packet04.centos.org (147.75.69.225): icmp_seq=2 ttl=43 time=209 ms
64 bytes from packet04.centos.org (147.75.69.225): icmp_seq=3 ttl=43 time=206 ms
^C

但是当我尝试使用 yum install 时,它失败了,我不明白为什么:

# yum install -y java-1.8.0-openjdk-devel
CentOS Linux 8 - BaseOS                                                                                                                                                                               0.0  B/s |   0  B     05:59    
Errors during downloading metadata for repository 'baseos':
  - Curl error (7): Couldn't connect to server for http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=BaseOS&infra=stock [Failed to connect to mirrorlist.centos.org port 80: Connection timed out]
Error: Failed to download metadata for repo 'baseos': Cannot prepare internal mirrorlist: Curl error (7): Couldn't connect to server for http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=BaseOS&infra=stock [Failed to connect to mirrorlist.centos.org port 80: Connection timed out]

有什么方法可以解决这个问题?

相关内容