Docker installation on CentOS 7

Docker installation on CentOS 7.

# Install Docker CE

## Set up the repository

### Install required packages.

yum install yum-utils device-mapper-persistent-data lvm2

### Add Docker repository.

yum-config-manager  --add-repo  https://download.docker.com/linux/centos/docker-ce.repo

## Install Docker CE.

yum update && yum install docker-ce-18.06.2.ce

## Create /etc/docker directory.

mkdir /etc/docker

# Setup daemon.

vim /etc/docker/daemon.json 


{
 "exec-opts": ["native.cgroupdriver=systemd"],
 "log-driver": "json-file",
 "log-opts": {
  "max-size": "100m"
 },
 "storage-driver": "overlay2",
 "storage-opts": [
  "overlay2.override_kernel_check=true"
 ]
}

Save and close that file.

mkdir -p /etc/systemd/system/docker.service.d

# Start Docker

systemctl start docker

# Restart Docker

systemctl daemon-reload
systemctl restart docker