前提机器是可以连通外网
[root@localhost ~]# yum install -y yum-utils device-mapper-persistent-data lvm2
已安装:
yum-utils.noarch 0:1.1.31-45.el7
作为依赖被安装:
libxml2-python.x86_64 0:2.9.1-6.el7_2.3 python-chardet.noarch 0:2.2.1-1.el7_1 python-kitchen.noarch 0:1.1.1-5.el7
完毕!
[root@localhost ~]# yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
[root@localhost ~]# yum makecache fast
[root@localhost ~]# yum -y install docker-ce
错误:软件包:containerd.io-1.2.13-3.2.el7.x86_64 (docker-ce-stable)
需要:container-selinux >= 2:2.74
错误:软件包:3:docker-ce-19.03.10-3.el7.x86_64 (docker-ce-stable)
需要:container-selinux >= 2:2.74
您可以尝试添加 --skip-broken 选项来解决该问题
您可以尝试执行:rpm -Va --nofiles --nodigest
[root@localhost ~]# yum -y install wget
已安装:
wget.x86_64 0:1.14-15.el7_4.1
完毕!
[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
[root@localhost ~]# yum install epel-release -y
已安装:
epel-release.noarch 0:7-11
完毕!
[root@localhost ~]# yum install container-selinux -y
已安装:
container-selinux.noarch 2:2.119.1-1.c57a6f9.el7
作为依赖被安装:
audit-libs-python.x86_64 0:2.8.5-4.el7 checkpolicy.x86_64 0:2.5-8.el7
libcgroup.x86_64 0:0.41-21.el7 libsemanage-python.x86_64 0:2.5-14.el7
policycoreutils-python.x86_64 0:2.5-34.el7
python-IPy.noarch 0:0.75-6.el7 setools-libs.x86_64 0:3.3.8-4.el7
作为依赖被升级:
audit.x86_64 0:2.8.5-4.el7 audit-libs.x86_64 0:2.8.5-4.el7
libselinux.x86_64 0:2.5-15.el7 libselinux-python.x86_64
0:2.5-15.el7 libselinux-utils.x86_64 0:2.5-15.el7
libsemanage.x86_64 0:2.5-14.el7 libsepol.x86_64 0:2.5-10.el7
policycoreutils.x86_64 0:2.5-34.el7 selinux-policy.noarch
0:3.13.1-266.el7 selinux-policy-targeted.noarch 0:3.13.1-266.el7
完毕!
[root@localhost ~]# yum -y install docker-ce
已安装:
docker-ce.x86_64 3:19.03.10-3.el7
作为依赖被安装:
containerd.io.x86_64 0:1.2.13-3.2.el7 docker-ce-cli.x86_64 1:19.03.10-3.el7
完毕!
启动即可使用
[root@localhost ~]# systemctl start docker
[root@localhost ~]# systemctl enable docker