Install Docker CE on RHEL 7

These are my notes on how to install Docker Community Edition (CE) on RHEL 7. I'm doing this on AWS AMI ami-029c0fbe456d58bd1. It has been upgraded to current as of the publish date of this post.

Register the RHEL 7 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

These extra repositories contain dependencies Docker CE will need

sudo subscription-manager repos --enable=rhel-7-server-rpms \
  --enable=rhel-7-server-extras-rpms \
  --enable=rhel-7-server-optional-rpms

Install Docker CE

Install requirements

sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo yum install -y yum-utils device-mapper-persistent-data lvm2

Add stable Docker CE repository

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

Install latest release, latest CLI, and latest containerd

sudo yum install -y docker-ce docker-ce-cli containerd.io

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