linux docker 安装报错:Requires: container-selinux >= 2:2.74

如题: docker 安装报错:

Error: Package: containerd.io-1.2.10-3.2.el7.x86_64 (docker-ce-stable)
           Requires: container-selinux >= 2:2.74
           Available: 2:container-selinux-1.10.3-59.el7.centos.x86_64 (extras)
               container-selinux = 2:1.10.3-59.el7.centos
           Available: 2:container-selinux-1.12.5-14.el7.centos.x86_64 (extras)
               container-selinux = 2:1.12.5-14.el7.centos
           Available: 2:container-selinux-2.9-4.el7.noarch (extras)
               container-selinux = 2:2.9-4.el7
           Available: 2:container-selinux-2.10-2.el7.noarch (extras)
               container-selinux = 2:2.10-2.el7
Error: Package: 3:docker-ce-19.03.4-3.el7.x86_64 (docker-ce-stable)
           Requires: container-selinux >= 2:2.74
           Available: 2:container-selinux-1.10.3-59.el7.centos.x86_64 (extras)
               container-selinux = 2:1.10.3-59.el7.centos
           Available: 2:container-selinux-1.12.5-14.el7.centos.x86_64 (extras)
               container-selinux = 2:1.12.5-14.el7.centos
           Available: 2:container-selinux-2.9-4.el7.noarch (extras)
               container-selinux = 2:2.9-4.el7
           Available: 2:container-selinux-2.10-2.el7.noarch (extras)
               container-selinux = 2:2.10-2.el7


查了各种帖子,装各种依赖都不行,后来查到这么一个命令可以了,记录一下:

yum install --setopt=obsoletes=0 \
   docker-ce-17.03.2.ce-1.el7.centos.x86_64 \
   docker-ce-selinux-17.03.2.ce-1.el7.centos.noarch # on a new system with yum repo defined, forcing older version and ignoring obsoletes introduced by 17.06.0

推荐阅读更多精彩内容