Solve Error: Package: docker-ce-xxx (docker-ce-stable) Requires: container-selinux >=

Posted on 9 views

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:


======================================================================================================================================================================================================
 Package                                            Arch                                    Version                                                     Repository                               Size
======================================================================================================================================================================================================
Installing:
 container-selinux                                  noarch                                  2:2.119.2-1.911c772.el7_8                                   extras                                   40 k

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:

Dependencies Resolved

======================================================================================================================================================================================================
 Package                                                  Arch                                  Version                                         Repository                                       Size
======================================================================================================================================================================================================
Installing:
 containerd.io                                            x86_64                                1.5.10-3.1.el7                                  docker-ce-stable                                 30 M
 docker-ce                                                x86_64                                3:20.10.13-3.el7                                docker-ce-stable                                 22 M
 docker-ce-cli                                            x86_64                                1:20.10.13-3.el7                                docker-ce-stable                                 30 M
Installing for dependencies:
 docker-ce-rootless-extras                                x86_64                                20.10.13-3.el7                                  docker-ce-stable                                8.1 M
 docker-scan-plugin                                       x86_64                                0.17.0-3.el7                                    docker-ce-stable                                3.7 M
 fuse-overlayfs                                           x86_64                                0.7.2-6.el7_8                                   extras                                           54 k
 fuse3-libs                                               x86_64                                3.6.1-4.el7                                     extras                                           82 k
 slirp4netns                                              x86_64                                0.4.3-4.el7_8                                   extras                                           81 k

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.

coffee

Gravatar Image
A systems engineer with excellent skills in systems administration, cloud computing, systems deployment, virtualization, containers, and a certified ethical hacker.