Have you encountered such an error while you were installing Docker-ce on Centos 7?

Error: Package: 3:docker-ce-20.10.13-3.el7.x86_64 (docker-ce-stable)
           Requires: container-selinux >= 2:2.74

Well, the easiest way to solve it is to install the container-selinux package. First check clean YUM cache:

sudo yum clean all

Update package cache:

sudo yum -y makecache

List all active repositories:

$ yum repolist
repo id                                                                                      repo name                                                                                          status
base/7/x86_64                                                                                CentOS-7 - Base                                                                                    10072
droplet-agent/x86_64                                                                         DigitalOcean Droplet Agent                                                                             8
extras/7/x86_64                                                                              CentOS-7 - Extras                                                                                    509
updates/7/x86_64                                                                             CentOS-7 - Updates                                                                                  3573
repolist: 14162

If Extras repository is not in the list please enable it:

### CentOS 7 ###
sudo yum -y install yum-utils
sudo yum-config-manager --enable extras

### RHEL 7 ###
sudo subscription-manager repos --enable=rhel-7-server-rpms \
  --enable=rhel-7-server-extras-rpms \
  --enable=rhel-7-server-optional-rpms

Then install the latest release of of the package container-selinux package.

sudo yum install container-selinux

Accept installation prompt:

....

Transaction Summary
======================================================================================================================================================================================================
Install  1 Package

Total download size: 40 k
Installed size: 41 k
Is this ok [y/d/N]: y

After this, proceed with the installation of docker-ce package from the official Docker repository:

sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install docker-ce docker-ce-cli containerd.io

All dependencies should be resolved:

...
Transaction Summary
======================================================================================================================================================================================================
Install  3 Packages (+5 Dependent packages)

Total download size: 95 M
Installed size: 382 M
Is this ok [y/d/N]: y

Start Docker service:

sudo systemctl enable --now docker

Add your user account to docker group:

sudo usermod -aG docker $USER
newgrp docker

Check Docker version:

$ docker --version
Docker version 20.10.13, build a224086 

This means we’ve been able to fix the issue and install Docker on CentOS 7 / RHEL 7 system. See other guides on docker shared below:

LEAVE A REPLY

Please enter your comment!
Please enter your name here