gpt4 book ai didi

docker - 如何修复 : yum install with error in docker container?

转载 作者:行者123 更新时间:2023-12-04 17:26:47 25 4
gpt4 key购买 nike

我只是想尝试在 centos:latest image 中安装 sshd。

我尝试安装“passwd”,键入如下命令:

yum 安装密码

但是我有这样的错误:

Failed to set locale, defaulting to C.UTF-8
CentOS-8 - AppStream 0.0 B/s | 0 B 00:30
Errors during downloading metadata for repository 'AppStream':
- Curl error (6): Couldn't resolve host name for http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=AppStream&infra=container [Could not resolve host: mirrorlist.centos.org]
Error: Failed to download metadata for repo 'AppStream': Cannot prepare internal mirrorlist: Curl error (6): Couldn't resolve host name for http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=AppStream&infra=container [Could not resolve host: mirrorlist.centos.org]

不知道为什么不能在docker容器中使用yum安装?

最佳答案

伪装允许 docker 入口和导出:

    firewall-cmd --zone=public --add-masquerade --permanent

特别允许端口 80/443 上的传入流量:

     firewall-cmd --zone=public --add-port=443/tcp

重新加载防火墙以应用永久规则:

     firewall-cmd --reload

重启 docker :

     systemctl restart docker

关于docker - 如何修复 : yum install with error in docker container?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62714688/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com