CentOS Docker installation


Docker supports the following CentOS versions:

  • CentOS 7 (64-bit)

  • ##CentOS 6.5 (64-bit ) or higher version


Prerequisites

Currently, only the kernel in the CentOS release version supports Docker.

Docker runs on CentOS 7, which requires the system to be 64-bit and the system kernel version to be 3.10 or above.

Docker runs on CentOS-6.5 or higher version of CentOS, which requires the system to be 64-bit and the system kernel version to be 2.6.32-431 or higher.


Use yum to install (under CentOS 7)

Docker requires the kernel version of the CentOS system to be higher than 3.10. Check the prerequisites on this page to verify whether your CentOS version supports Docker.

Check your current kernel version through the

uname -r command
[root@php ~]# uname -r 3.10.0-327.el7.x86_64

docker08.png

Install Docker

Docker software packages and dependency packages are already included In the default CentOS-Extras software source, the installation command is as follows:

[root@php ~]# yum -y install docker

docker09.png

The installation is completed.

docker10.png

Start Docker background service

[root@php ~]# service docker start

docker11.png##Test run hello-world

[root@php ~]#docker run hello-world

docker12.pngSince there is no hello-world image locally, a hello-world image will be downloaded and run in the container.

Use a script to install Docker

1. Log in to Centos using

sudo

or root permissions. 2. Make sure the yum package is updated to the latest.

$ sudo yum update

3. Execute the Docker installation script.

$ curl -fsSL https://get.docker.com/ | sh

Executing this script will add the

docker.repo

source and install Docker. 4. Start the Docker process.

$ sudo service docker start

5. Verify that

docker

is installed successfully and execute a test image in the container.

$ sudo docker run hello-world
At this point, the installation of docker on the CentOS system is completed.