用dockefile创建镜像出现Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
DOckerfile如图
这是由于centos在20年停止更新后在使用yum时报的错误
接下来是解决方法
1.进入yum的repos目录
cd /etc/yum.repos.d/
2.修改所有的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-*
3.更新源为阿里镜像
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
yum clean all
yum makecache
4.安装测试
yum install wget –y
问题解决了!!!