参考文档:
https://developer.aliyun.com/article/1148896
https://blog.csdn.net/qq_32828933/article/details/88656414
https://unix.stackexchange.com/questions/250249/error-after-installing-dnf-on-centos-7
http://www.hackdig.com/01/hack-248914.htm
https://www.cnblogs.com/wangqingyong/p/14228735.html
安装社区版Docker(docker-ce)
1. 下载docker-ce的yum源:
wget -O /etc/yum.repos.d/docker-ce.repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
2. 安装docker-ce:
yum -y install docker-ce
可能会报错:
Error: Package: containerd.io-1.6.21-3.1.el7.x86_64 (docker-ce-stable)
Requires: container-selinux >= 2:2.74
Error: Package: docker-ce-rootless-extras-24.0.1-1.el7.x86_64 (docker-ce-stable)
Requires: slirp4netns >= 0.4
Error: Package: 3:docker-ce-24.0.1-1.el7.x86_64 (docker-ce-stable)
Requires: container-selinux >= 2:2.74
Error: Package: docker-ce-rootless-extras-24.0.1-1.el7.x86_64 (docker-ce-stable)
Requires: fuse-overlayfs >= 0.7
解决:
https://developer.aliyun.com/article/1148896
查看有没有
yum search container-selinux
结果:
warning: Found BDB Packages database while attempting lmdb backend: using bdb backend. Loaded plugins: branch, fastestmirror, langpacks Trying branch: stable Loading mirror speeds from cached hostfile * epel: mirrors.tuna.tsinghua.edu.cn warning: Found BDB Packages database while attempting lmdb backend: using bdb backend. warning: Found BDB Packages database while attempting lmdb backend: using bdb backend. Warning: No matches found for: container-selinux No matches found
发现没有这个
解决方式:去官网找,增加官网源
在docker-ce.repo中添加centos-extras源
vim /etc/yum.repos.d/docker-ce.repo 在文档最上面添加源 [centos-extras] name=Centos extras - $basearch enabled=1 gpgcheck=0 baseurl=http://mirror.centos.org/centos/7/extras/x86_64
配置完成后的
esc -> :wq 保存退出后,安装三个包:
yum install slirp4etns fuse-overlayfs container-selinux
然后安装docker:
yum -y install docker-ce
启动、查看状态:
systemctl start docker systemctl status docker
刚开始参考的:https://help.aliyun.com/document_detail/264695.html?spm=a2c4g.187598.0.0.37c31e18BJaJiR (Alibaba Cloud Linux 3)
发现不行,卡在
Failed to open: /var/cache/dnf/x86_64/7.2/x86_64/7.2/epel/repodata/bcad035bfd456bd33c633b0cefd435c50fd59150e22552236db05ea139f8937b-updateinfo.xml.bz2.
网上说卸载掉: epel-release
但卸载完发现安装不了 docker,报:
No package docker available.
进入死循环,遂先放弃,回头再研究