How To Install Docker on an AWS Instance of RedHat Linux

Update on 9/10/19: These directions 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/
chmod u+x
 #then paste everything below up to and including the 'echo "docker run -it centos /bin/bash"' line

#Written by
yum -y update
echo '
name=Docker Repository
gpgkey=' > /etc/yum.repos.d/docker.repo
yum -y install docker-engine
groupadd docker
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.)

Leave a comment

Your email address will not be published. Required fields are marked *