Objective

The objective is to install Docker engine on Redhat 7 Linux using native docker script.

Requirements

Internet connection as well as a privileged access to your Redhat 7 Linux is required.

Difficulty

EASY

Conventions

  • # - requires given command to be executed with root privileges either directly as a root user or by use of sudo command
  • $ - given command to be executed as a regular non-privileged user

Instructions

Install docker

Installation of docker using a native docker script is one command, straight forward process. Before you run the below docker installation command ensure that curl package is installed on your system:
# curl --version
curl 7.29.0 (x86_64-redhat-linux-gnu)
Once ready, install docker using curl command which will download and execute a native docker installation script:
# curl -sSL https://get.docker.com/ | sh
+ sh -c 'sleep 3; yum -y -q install docker-engine'
warning: /var/cache/yum/x86_64/7Server/docker-main-repo/packages/docker-engine-1.12.3-1.el7.centos.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 2c52609d: NOKEY
Importing GPG key 0x2C52609D:
 Userid     : "Docker Release Tool (releasedocker) "
 Fingerprint: 5811 8e89 f3a9 1289 7c07 0adb f762 2157 2c52 609d
 From       : https://yum.dockerproject.org/gpg
If you would like to use Docker as a non-root user, you should now consider
adding your user to the "docker" group with something like:

  sudo usermod -aG docker your-user

Remember that you will have to log out and back in for this to take effect!

Enable and Start docker

To enable docker to start on your Redhat 7 Linux after reboot run the following command:
# systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
To start docker daemon run:
# systemctl start docker

Testing

To test docker installation run:
# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
c04b14da8d14: Pull complete 
Digest: sha256:0256e8a36e2070f7bf2d0b0763dbabdd67798512411de4cdcf9431a1feb60fd9
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.
You can list your new container with:
# docker ps -a