1. Yum way

Step 1: Install the necessary system tools

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

Step 2: Add software source information

Sudo yum – config – manager – add – repo mirrors.aliyun.com/docker-ce/l…

Step 3: Update and install docker-CE

sudo yum makecache fast

sudo yum -y install docker-ce

Step 4: Enable the Docker service

sudo service docker start

# note:

By default, the latest software is enabled in the official software source. You can obtain each version of the software package by editing the software source. For example, the software source of the test version is not available. You can enable the software source in the following way: In the same way, various test versions can be opened.

vim /etc/yum.repos.d/docker-ee.repo

[docker-ce-test] set enabled=0 to enabled=1

Docker-ce:

Step 1: Find the docker-CE version.

yum list docker-ce.x86_64 –showduplicates | sort -r

Loading mirror speeds from cached hostfile

Loaded plugins: branch, fastestmirror, langpacks

Docker – ce. X86_64 17.03.1. Ce – 1. El7. Centos docker – ce – stable

Docker – ce. X86_64 17.03.1. Ce – 1. El7. Centos @ docker, ce, and stable

Docker – ce. X86_64 17.03.0. Ce – 1. El7. Centos docker – ce – stable

Available Packages

Step2: install the specified VERSION of docker-ce: (VERSION, e.g. 17.03.ce.1-1. El7.centos)

sudo yum -y install docker-ce-[VERSION]

  1. The RPM way

Find a machine with an Internet connection and download the Docker package offline

yum -y install –downloadonly –downloaddir=/home docker