1、遇到问题:[Errno 14] curl#35 - "TCP connection reset by peer"、failure: repodata/repomd.xml from docker-ce-stable: [Errno 256] No more mirrors to try.
解决方式:使用以下命令设置镜像仓库
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
2、运行命令行yum -y install docker-ce报错
Error: Package: containerd.io-1.6.33-3.1.el7.x86_64 (docker-ce-stable) Requires
: container-selinux >= 2:2.74
Error: Package: docker-ce-rootless-extras-26.1.4-1.el7.x86_64 (docker-ce-stable
) Requires: slirp4netns >= 0.4
Error: Package: 3:docker-ce-26.1.4-1.el7.x86_64
(docker-ce-stable) Requires: container-selinux >= 2:2.74
Error: Package: docke
r-ce-rootless-extras-26.1.4-1.el7.x86_64 (docker-ce-stable) Requires: fuse-over
layfs >= 0.7 You could try using --skip-broken to work around the problem You c
ould try running: rpm -Va --nofiles --nodigest
原因:
主要错误是缺少几个依赖包:
-
container-selinux >= 2:2.74
-
slirp4netns >= 0.4
-
fuse-overlayfs >= 0.7
这些依赖包通常包含在额外的CentOS存储库中。
解决方法:
(1)修改CentOS额外存储库的URL: 创建 /etc/yum.repos.d/docker-ce.repo
文件
mkdir -p
/etc/yum.repos.d/docker-ce.repo
添加以下内容:
[centos-extras]
name=Centos extras - $basearch baseurl=http://vault.centos.org/7.9.2009/extras/x86_64/
enabled=1
gpgcheck=1
gpgkey=http://vault.centos.org/7.9.2009/CentOS-CRPM-GPG-KEY-CentOS-7
(2)清理yum缓存、更新yum缓存
sudo yum clean all
sudo yum makecache
(3)尝试安装依赖包:
sudo yum install -y slirp4netns fuse-overlayfs container-selinux
(4)再次尝试安装docker
sudo yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin