Update on 11/20/20: We recommend you see How Do You Install the docker.service File on RHEL 8.x? instead of the directions below. (Many times this command will work:
sudo yum -y install docker )
Update on 9/10/19: These directions below work to install Docker version 17.05.0-ce on RHEL 8.x. These "directions" to install Docker on RedHat Enterprise Linux include a script and how to run it. The script was designed to install Docker 1.12 on an AWS instance of RHEL 7.x. This script requires that your AWS RHEL server is in a security group that has access to the Internet. The script takes approximately 10 minutes to run. But bandwidth and resources on your instance may vary. The benefit of these directions is that they will work when you may not run the "yum-config-manager" command. The script below uses CentOS packages which are not ideal for RHEL. If you can run the "yum-config-manager" command, see these alternative directions. (If you want a variety of different directions for installing Docker, please see this posting.) Step #1 Log in and become root.
Step #2 Run these commands:
cd /tmp/ #then paste everything below up to and including the 'echo "docker run -it centos /bin/bash"' line
chmod u+x installer.sh
#Written by continualintegration.com
yum -y update
gpgkey=https://yum.dockerproject.org/gpg' > /etc/yum.repos.d/docker.repo
yum -y install docker-engine
usermod -aG docker ec2-user
service docker start
echo "run 'docker run hello-world' to test it out"
echo "Afterward, you can run "
echo "docker run -it ubuntu bash"
echo "or you can run"
echo "docker run -it centos /bin/bash"
echo "Log out and log back in"
Step #4 Save the file.
Step #5 Run the script with a command like this:
Step #6 Test it with a command like this:
docker run hello-world
(You may need to log out and log back in. Instead of the "chmod" command above, you could run it with "sudo bash".)
Step #7 Enter a docker container with a command like this:
docker run -it centos /bin/bash
(If you want to install Docker on a RHEL VM running in GCP, see this posting.)
We recommend you see How Do You Install the docker.service File on RHEL 8.x? instead of the directions above.