原因是yum不能使用本地形式

  1. #yum install vsftpd
  2. /etc/vsftpd/vsftpd.conf 在此文件下添加anon_root=/opt //添加这行,设置共享目录(我这里就共享opt目录啦)前提你的opt地下得有yum所需要的文件
    # Dockerfile出现failure: repodata/repomd.xml from centos: [Errno 256] No more mirrors to try.yum报错

3.然后修改你的yum文件, docker.repo(是与Dockerfile同目录的yum文件),把你的yum路径都改成源是指向我们的docker的yum源
# Dockerfile出现failure: repodata/repomd.xml from centos: [Errno 256] No more mirrors to try.yum报错
4.然后重新构建,就成功了
# Dockerfile出现failure: repodata/repomd.xml from centos: [Errno 256] No more mirrors to try.yum报错

Dockerfile小知识

在使用Dockerfile构建镜像时,所在的目录一定要使用一个干净的目录(最好新建一个目录),以免其目录下有其他文件(构建时会加载当前目录下所有的文件,导致磁盘爆满)
# Dockerfile出现failure: repodata/repomd.xml from centos: [Errno 256] No more mirrors to try.yum报错

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-04-25
  • 2022-12-23
  • 2021-09-28
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-08-11
  • 2021-12-22
  • 2022-01-17
  • 2022-12-23
  • 2021-03-31
  • 2022-12-23
  • 2021-11-10
相关资源
相似解决方案