编程知识 cdmana.com

关于centos docker版本过低导致 is not a valid repository/tag: invalid reference format

1. 在执行

       
docker build . --no-cache -t xxx
  • 1.

命令时,报

Error parsing reference: "xxx/ubuntu20.04:117486 AS build" is not a valid repository/tag: invalid reference format

2. 分析,这个xxx/ubuntu20.04:117486 中并没有大写字符,因此排查是docker image 大小写

3. 查看docker version

       
[[email protected] mdc-ecdn-monitor]# docker --version
Docker version 1.13.1, build 7d71120/1.13.1
  • 1.
  • 2.

证明确实是版本太低

4. 解决步骤:

卸载旧版本:

       
yum -y remove docker*
  • 1.

安装依赖包

       
[[email protected] mdc-ecdn-monitor]# sudo yum install -y yum-utils
Loaded plugins: fastestmirror, product-id, search-disabled-repos, subscription-manager

This system is not registered with an entitlement server. You can use subscription-manager to register.

Loading mirror speeds from cached hostfile
* base: mirrors.cn99.com
* extras: mirrors.ustc.edu.cn
* updates: mirrors.cn99.com
http://10.20.12.4/cobbler/ks_mirror/CentOS_7.9/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 10.20.12.4:80; Connection refused"
Trying other mirror.
http://10.20.12.4/cobbler/ks_mirror/CentOS_7.9/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 10.20.12.4:80; Connection refused"
Trying other mirror.
http://10.20.12.4/cobbler/ks_mirror/CentOS_7.9/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 10.20.12.4:80; Connection refused"
Trying other mirror.
http://10.20.12.4/cobbler/ks_mirror/CentOS_7.9/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 10.20.12.4:80; Connection refused"
Trying other mirror.
http://10.20.12.4/cobbler/ks_mirror/CentOS_7.9/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 10.20.12.4:80; Connection refused"
Trying other mirror.
http://10.20.12.4/cobbler/ks_mirror/CentOS_7.9/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 10.20.12.4:80; Connection refused"
Trying other mirror.
http://10.20.12.4/cobbler/ks_mirror/CentOS_7.9/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 10.20.12.4:80; Connection refused"
Trying other mirror.
http://10.20.12.4/cobbler/ks_mirror/CentOS_7.9/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 10.20.12.4:80; Connection refused"
Trying other mirror.
http://10.20.12.4/cobbler/ks_mirror/CentOS_7.9/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 10.20.12.4:80; Connection refused"
Trying other mirror.
http://10.20.12.4/cobbler/ks_mirror/CentOS_7.9/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 10.20.12.4:80; Connection refused"
Trying other mirror.
Package yum-utils-1.1.31-54.el7_8.noarch already installed and latest version
Nothing to do
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.

添加镜像信息

       
[[email protected] mdc-ecdn-monitor]# yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
Loaded plugins: fastestmirror, product-id, subscription-manager

This system is not registered with an entitlement server. You can use subscription-manager to register.

adding repo from: http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
grabbing file http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.

安装docker CE

       
[[email protected] mdc-ecdn-monitor]# yum install docker-ce docker-ce-cli containerd.io
  • 1.

配置国内源

       
mkdir -p /etc/docker
tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": [
"https://kfwkfulq.mirror.aliyuncs.com",
"https://2lqq34jg.mirror.aliyuncs.com",
"https://pee6w651.mirror.aliyuncs.com",
"https://registry.docker-cn.com",
"http://hub-mirror.c.163.com"
],
"dns": ["8.8.8.8","8.8.4.4"]
}
EOF
systemctl daemon-reload
systemctl restart docker
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.

查看最新版本

       
[[email protected] mdc-ecdn-monitor]# docker --version
Docker version 20.10.11, build dea9396
  • 1.
  • 2.

升级ok ,问题解决

版权声明
本文为[Ai_Yang]所创,转载请带上原文链接,感谢
https://blog.51cto.com/u_15284125/4689023

Scroll to Top