(Last Updated On: October 23, 2018)

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

Error: Package: docker-ce-18.06.1.ce-3.el7.x86_64 (docker-ce-stable)
           Requires: container-selinux >= 2.9

Well, the easiest way to solve it is to install the container-selinux package. To do this, go to the official Centos Mirror, http://mirror.centos.org/centos/7/extras/x86_64/Packages/ and find the latest of the package. It is container-selinux-2.42-1.gitad8f0f7.el7.noarch.rpm at the time of writing this. Once you have it, copy its link address(url), head to the terminal of the server you would like to install docker in and run:

yum -y install yum -y install http://mirror.centos.org/centos/7/extras/x86_64/Packages/container-selinux-2.42-1.gitad8f0f7.el7.noarch.rpm
Loaded plugins: fastestmirror
container-selinux-2.42-1.gitad8f0f7.el7.noarch.rpm                                        |  32 kB  00:00:00     
Examining /var/tmp/yum-root-EnC13P/container-selinux-2.42-1.gitad8f0f7.el7.noarch.rpm: 2:container-selinux-2.42-1.gitad8f0f7.el7.noarch
Marking /var/tmp/yum-root-EnC13P/container-selinux-2.42-1.gitad8f0f7.el7.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package container-selinux.noarch 2:2.42-1.gitad8f0f7.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=================================================================================================================
 Package             Arch     Version                    Repository                                         Size
=================================================================================================================
Installing:
 container-selinux   noarch   2:2.42-1.gitad8f0f7.el7    /container-selinux-2.42-1.gitad8f0f7.el7.noarch    34 k

After this, proceed with the installation of docker-ce

yum -y install docker-ce
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package docker-ce.x86_64 0:18.06.1.ce-3.el7 will be installed
--> Processing Dependency: libltdl.so.7()(64bit) for package: docker-ce-18.06.1.ce-3.el7.x86_64
--> Running transaction check
---> Package libtool-ltdl.x86_64 0:2.4.2-22.el7_3 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=================================================================================================================
 Package                   Arch                Version                       Repository                     Size
=================================================================================================================
Installing:
 docker-ce                 x86_64              18.06.1.ce-3.el7              docker-ce-stable               41 M