Let’s see how Red Hat Enterprise Linux and Docker are playing well together.
The simple search on google “install docker RHEL” will lead you off the track as easy as it gets. Some of the top results include:
- How to install and setup Docker on RHEL 7/CentOS 7
- How to install Docker CE on RHEL 8 / CentOS 8
- How To Install Docker on CentOS 7 / RHEL 7
- Install Docker CE on CentOS and RHEL 7
These tutorials have one thing in common. They are explaining how we can install Docker CE on RHEL.
DON’T
There are many reasons not to do this. First off all Docker CE is not even supported for Red Hat Enterprise Linux.
But we’ve managed to install Docker CE Link to heading
Sure but we’ll probably have issues when building RHEL based Docker images. RHEL requires a subscription to install/update packages with yum. So if we want to create RHEL based images, we must have an active subscription. Docker CE will not pass the Red Hat Subscription Management information from the host into containers, and we don’t want to add an active subscription to every Docker image we build. 😉
Ok, now what?
Well for average user installing Docker from RPM will be enough. If we really would like to have the latest and greatest, then we must go for Docker Engine - Enterprise for Red Hat Enterprise.
Installing Docker from RPM Link to heading
First, we must ensure we are using Red Hat’s supported docker package on a registered RHEL or Atomic Server.
First register system to Red Hat account
$ subscription-manager register --username=<USERNAME> --password=<PASSWORD>
# or
$ subscription-manager register --org=<ORG> --activationkey=<KEY_NAME>
Let’s enable the following repositories after our system is registered
$ subscription-manager repos --enable rhel-7-server-optional-rpms --enable rhel-7-server-extras-rpms --enable rhel-server-rhscl-7-rpms
Let’s install the docker package from RPM as root user
$ yum install docker
$ systemctl enable docker
$ systemctl start docker
$ docker info
# Run Hello World
$ docker run hello-world
There is a patch in RHEL docker package which provides subscription management information from the host into containers for both docker run
and docker build
. More about the patch itself.
Red Hat Enterprise Linux Universal Base Images (UBI) Link to heading
The second option is to use the Universal Base Images (UBI). With UBI images, we don’t need an active RHEL subscription to build custom images. The UBI images can be used on any Linux distribution and also with Docker CE or Podman.
And remember, contributions earn you karma. 😜