1) sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
2) sudo yum install docker-ce docker-ce-cli containerd.io
3) 上面2)应该会出错,告诉你container-selinux的版本不够
4)
Installing the Selinux from the Centos repository worked for me:
1. Go to http://mirror.centos.org/centos/7/extras/x86_64/Packages/
2. Find the latest version for container-selinux i.e. container-selinux-2.21-1.el7.noarch.rpm
3. Run the following command on your terminal: $ sudo yum install -y http://mirror.centos.org/centos/7/extras/x86_64/Packages/**Add_current_container-selinux_package_here**
4. The command should looks like the following $ sudo yum install -y http://mirror.centos.org/centos/7/extras/x86_64/Packages/container-selinux-2.21-1.el7.noarch.rpm
参考: