Container runtimes is required for Kubernetes to work , one of the popular container runtime is docker. This tutorial will guide you how we can install docker for Kubernetes on CentOS.
Step 1: Install required packages for Docker
[~]# yum install yum-utils device-mapper-persistent-data lvm2 -y
Step 2: Add Docker repository for installation
[~]# yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
Step 3: Install Docker CE engine
[~]# yum update && yum install docker-ce-18.06.2.ce -y
Step 4: Create /etc/docker directory for Docker
[~]# mkdir /etc/docker
Step 5: Setup Docker daemon
[~]# cat > /etc/docker/daemon.json <<EOF
{
"exec-opts": ["native.cgroupdriver=systemd"],
"log-driver": "json-file",
"log-opts": {
"max-size": "100m"
},
"storage-driver": "overlay2",
"storage-opts": [
"overlay2.override_kernel_check=true"
]
}
EOF
[~]# mkdir -p /etc/systemd/system/docker.service.d
Step 6: Start and enable Docker daemon
[~]# systemctl daemon-reload
[~]# systemctl restart docker
Reference: https://docs.docker.com/install/