Learn Docker With My Newest Course

Dive into Docker takes you from "What is Docker?" to confidently applying Docker to your own projects. It's packed with best practices and examples. Start Learning Docker →

Docker Tip #39: Installing Docker CE on RedHat (RHEL) 7.x

blog/cards/docker-tips-and-tricks.jpg

Docker CE is not officially supported on RHEL but if you're in a pinch, you can get the latest Docker CE installed on it.

I’ll admit, I’m not a RedHat expert. I’ve been using Debian based distros since the beginning but recently I was in a position where I had to get Docker CE installed on RedHat 7.2.

It wasn’t my position to question or attempt to persuade anyone into changing. My only task was “get the latest version of Docker CE installed on RHEL 7.x”.

If you follow the CentOS instructions for Docker CE , chances are you got the dreaded Requires: container-selinux >= 2.9 error when trying to install CE on RedHat 7.x.

Here’s what I eventually ended up doing which worked:
sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum makecache fast
sudo yum install -y http://mirror.centos.org/centos/7/extras/x86_64/Packages/container-selinux-2.33-1.git86f33cd.el7.noarch.rpm
sudo yum install -y docker-ce

This just installs a more recent version of container-selinx before installing Docker.

One thing to note is the long mirror.centos.org command. You’ll want to check the list of extra packages for the latest version of container-selinux. At the time of writing this article it was 2.33.1.

You can check by going to http://mirror.centos.org/centos/7/extras/x86_64/Packages/. Just copy the link address for the latest container-selinux and replace mine from above.

Is it safe in production?

That’s for you and your organization to decide. It’s safe in the sense that you are pulling things down from an official CentOS repository. However…

Since you’re pulling in a CentOS repository, that will void all support from RHEL which kind of defeats the purpose of being a RHEL subscriber, but sometimes you get handed a problem with no alternative solution.

Free Intro to Docker Email Course

Over 5 days you'll get 1 email per day that includes video and text from the premium Dive Into Docker course. By the end of the 5 days you'll have hands on experience using Docker to serve a website.



Comments