
Use dnf install or yum install command to install the DNF or YUM Utilities package.
dnf install dnf-utils
Use the dnf-config-manager or yum-config-manager command to add the docker-ce.repo (Docker Community Editon Repository).
dnf-config-manager --add-repo https://download.docker.com/linux/rhel/docker-ce.repo
The docker-ce.repo should now be listed in the /etc/yum.repos.d directory.
~]$ ls -l /etc/yum.repos.d/
-rw-r--r--. 1 root root 1883 Mar 23 11:58 docker-ce.repo
According to https://docs.docker.com/engine/install/rhel/#prerequisites, "We currently only provide packages for RHEL on s390x (IBM Z). Other architectures are not yet supported for RHEL, but you may be able to install the CentOS packages on RHEL. Refer to the Install Docker Engine on CentOS page for details". For this reason, the docker-ce.repo file will need to be updated to have centos instead of rhel.
sed -i 's|rhel|centos|g' /etc/yum.repos.d/docker-ce.repo
Install Docker.
dnf install docker-ce
The which command can be used to determine the absolute path to the docker command line tool.
which docker
Something like this should be returned.
/usr/bin/docker
The systemctl or service command can be used to start and enable docker.
systemctl enable docker
systemctl start docker
Did you find this article helpful?
If so, consider buying me a coffee over at