Docker Install

Docker
Install
1
Introduction
2
Understanding Containers
3
ACI Access Policies
4
VMware Domain Definition
5
Linux Host Setup
6
ACI Kubernetes
7
Configure VMware Integration
8
Initialize Kubernetes
9
Deploy Applications
10
Conclusion
11
Reference

Step 1 - Install repo utilities

Before we install docker, you will install some utilities that are required for docker to run on the OS.


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

Step 2 - Install EPEL repository


yum -y install epel-release 

Step 3 - Install Python Package management tools


yum -y install python-wheel python-pip
pip install --upgrade pip

Step 4 - Add repository for docker

You will need to add the docker community edition repository into the linux distribution.


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

Now that you used yum-config-manager to insert the repo, you need to tell yum to re-read cache.


yum makecache fast

Step 5 - Install docker community edition

As every major software in the industry, Docker has different versions of code. This becomes very important because users need to know which version to install in their environment. By default when if you install Docker in your system. It would always install the lastest version unless the user specify the exact version, and this may become an issue.

In order to check the available Docker version, you can execute the followiing command.


repoquery --show-duplicates docker-ce

The output will include the versions of code available in the repositories.

The output might vary from that listed in the lab document.
docker-ce-0:17.03.0.ce-1.el7.centos.x86_64
docker-ce-0:17.03.1.ce-1.el7.centos.x86_64
docker-ce-0:17.03.2.ce-1.el7.centos.x86_64
docker-ce-0:17.03.3.ce-1.el7.x86_64
docker-ce-0:17.06.0.ce-1.el7.centos.x86_64
docker-ce-0:17.06.1.ce-1.el7.centos.x86_64
docker-ce-0:17.06.2.ce-1.el7.centos.x86_64
docker-ce-0:17.09.0.ce-1.el7.centos.x86_64
docker-ce-0:17.09.1.ce-1.el7.centos.x86_64
docker-ce-0:17.12.0.ce-1.el7.centos.x86_64
docker-ce-0:17.12.1.ce-1.el7.centos.x86_64
docker-ce-0:18.03.0.ce-1.el7.centos.x86_64
docker-ce-0:18.03.1.ce-1.el7.centos.x86_64
docker-ce-0:18.06.0.ce-3.el7.x86_64
docker-ce-0:18.06.1.ce-3.el7.x86_64
docker-ce-0:18.06.2.ce-3.el7.x86_64
docker-ce-0:18.06.3.ce-3.el7.x86_64
docker-ce-3:18.09.0-3.el7.x86_64
docker-ce-3:18.09.1-3.el7.x86_64
docker-ce-3:18.09.2-3.el7.x86_64
docker-ce-3:18.09.3-3.el7.x86_64
docker-ce-3:18.09.4-3.el7.x86_64
docker-ce-3:18.09.5-3.el7.x86_64
docker-ce-3:18.09.6-3.el7.x86_64
docker-ce-3:18.09.7-3.el7.x86_64
docker-ce-3:18.09.8-3.el7.x86_64
docker-ce-3:18.09.9-3.el7.x86_64
docker-ce-3:19.03.0-3.el7.x86_64
docker-ce-3:19.03.1-3.el7.x86_64
docker-ce-3:19.03.2-3.el7.x86_64
docker-ce-3:19.03.3-3.el7.x86_64
docker-ce-3:19.03.4-3.el7.x86_64
docker-ce-3:19.03.5-3.el7.x86_64
For every release of Kubernetes there is a specified compatibility list relation to Docker. This is listed in the kubernetes release notes in github. For the release of Kubernetes 1.16 the compatible list is.

  • 1.13.1
  • 17.03
  • 17.06
  • 17.09
  • 18.06
  • 18.09

The production environment documentation recommends running 19.03.4. as of the writing/update of this section. To determine the correct version of docker you must always read the Kubernetes documentation page, being the release notes or other official pages that provide the correct insight. Usually there is a gamut of versions that will work correctly with Kubernetes.

Based on this, we will be leveraging version docker-ce-3:19.03.4-3.el7.x86_64. In addition you will also install docker-ce-cli package and the containerd package. More information on Kubernetes container production runtimes can be found here.


yum install -y docker-ce-3:19.03.4-3.el7.x86_64 docker-ce-cli-1:19.03.4-3.el7.x86_64 containerd.io-0:1.2.10-3.2.el7.x86_64

Step 6 - Setup the docker daemon configuration

First you will need to create a new directory under /etc.


mkdir /etc/docker

In this directory the following file needs to be created. This is a JSON file that sets the proper cgroup driver required by the docker/kubernetes integration.


cat << EOF > /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"
  ]
}
EOF

Step 7 - Enable and start Docker service

With all these modifications you can now enable the docker service and start the docker service


systemctl enable docker.service 


systemctl start docker.service 

Verify that the service is started and working properly.


systemctl status docker.service 

[root@pod09-master ~]# systemctl status docker.service
docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
Active: 
    active (running) 
since Fri 2018-05-04 09:46:16 EDT; 1 day 5h ago
Docs: https://docs.docker.com
Main PID: 24923 (dockerd)
CGroup: /system.slice/docker.service

You can also verify that Docker is correctly set to use systemd.


docker info | grep -i cgroup

[root@pod09-master ~]# docker info | grep -i cgroup

    Cgroup Driver: systemd