Bootstrap

docker 创建容器后,容器内部yum不能在线拉取使用

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: mirrorl

最开始,我以为是网关的问题,修改了好几次,最后发现是网络连接问题

进入到 yum 的 repos 目录

cd /etc/yum.repos.d/

修改 centos 文件内容

sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*

缓存更新

yum makecache

运行 yum update 并重新安装 vim

yum update -y
yum -y install vim

;