Install Docker CE on RHEL 8/9

These are my notes on how to install Docker Community Edition (CE) on RHEL 8/9. I'm doing this on RHEL 8 AWS AMI ami-0b0af3577fe5e3532. It has been upgraded to current as of the publish date of this post. It has also been tested against the latest RHEL 9 AWS AMI.

Register the RHEL 8 instance

Register to Red Hat Subscription Manager

sudo subscription-manager register --auto-attach

You’ll be prompted to provide your Red Hat subscription's username and password.

Enable extra repositories

Only the appstream and baseos repositories are enabled by default. We need to enable the docker-ce repository to be able to install Docker CE.

sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo

Install Docker CE

Install latest release

sudo dnf install docker-ce

If the previous command fails to install docker-ce properly, add the --nobest switch and try again

sudo dnf install --nobest docker-ce

Add non-privileged user to docker group

sudo usermod -aG docker $USER

Apply group membership without shell restart

newgrp docker

Start and enable Docker service

This will set the Docker service to start at boot

sudo systemctl enable --now docker.service

Check that it installed correctly and you recognize you are a member of the docker group

docker ps

If it is working, you should see the response:

CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES