Relevant posts
Step 0 – Prerequisites
Docker requires a 64-bit OS and version 3.10 or higher of the Linux kernel. To check your OS architecture and kernel version:
$ uname -r
The output:

Run yum packages update
$ sudo yum update
Step 1 – Add Docker repo
Create the docker.repo file
$ sudo touch /etc/yum.repos.d/docker.repo
Open docker.repo
$ sudo vi /etc/yum.repos.d/docker.repo
Add the following in docker.repo:
[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/7/
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/7/
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg
Step 2 – Install docker-engine
$ sudo yum install docker-engine
The output:

Step 3 – Start and enable docker
$ sudo systemctl start docker
$ sudo systemctl enable docker
$ sudo systemctl enable docker
Step 4 – Add user to docker group
The docker engine, for communication uses Unix socket instead of a TCP port, the socket is owned by root user, other users can access it using sudo, otherwise you may get “Cannot connect to the Docker daemon. Is the docker daemon running on this host?”. To directly use docker command, create a docker group (will has read/write permission on the socket) and add your user to it.
Create the docker group
$ sudo groupadd docker
Add your user to docker group
$ sudo usermod -aG docker <your_username>
Log out and log back in
Step 5 – Verification
Verify if docker engine is installed properly and the added user works without sudo.
docker run hello-world
The output:
