Install Docker-CE on RHEL7

Considering you have subscription of RHEL, the steps are as follows:

  1. Register to RHEL
#subscription-manager register --username <username> --password <password>

2. Install yum utils

#yum install yum-utils

2. Install container-selinux

##subscription-manager repos --enable=rhel-7-server-extras-rpms
or
#subscription-manager repos --enable=rhel-7-workstation-extras-rpms
#yum install container-selinux

3. Add docker-ce repo

#yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repoedit /etc/yum.repo.d/docker-ce.repo file and replace '$releasever/$basearch' by '7/x86_64' at all places.#yum-config-manager — enable docker-ce-nightly docker-ce-test

4. Install docker-ce

#yum install docker-ce docker-ce-cli containerd.io
#systemctl enable docker
#systemctl start docker
#systemctl status docker

5. Download the current stable release of Docker Compose.
To find the latest version refer site https://docs.docker.com/compose/install/ under tab Linux. Here, it is 1.26.2.

#curl -L “https://github.com/docker/compose/releases/download/1.26.2/docker-compose-$(uname -s)-$(uname -m)” -o /usr/local/bin/docker-composereplace 1.26.2 the latest version of docker-compose

6. Apply executable permissions to the binary and create a symbolic link to /usr/bin

#chmod +x /usr/local/bin/docker-compose
#sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

8. Test the installation

#docker-compose -v
#docker -v

Troubleshoot:

1. Remove previous version of docker

#yum remove docker docker-client docker-common docker-compose

2. Error “permission denied while trying to connect to the Docker daemon socket”

$sudo groupadd docker
$sudo usermod -aG docker ${USER}
$ newgrp docker
$ docker run hello-world
Reboot if still got error

System Administrator and Full stack web developer.