The first use of Tsinghua source image
If you have previously installed Docker, please delete it first.
sudo yum remove Docker Docker-common docker-selinux docker-engine
sudo yum install-y yum-utils device-mapper-persistent-data lvm2
Download the repo file according to your release: Centos/rhel Fedora
Wget-o/etc/yum.repos.d/docker-ce.repo Https://download.docker.com/linux/centos/docker-ce.repo
Replace the repository address with TUNA:
sudo sed-i ' s+download.docker.com+mirrors.tuna.tsinghua.edu.cn/docker-ce+ '/etc/yum.repos.d/docker-ce.repo
Final installation:
sudo yum makecache fast
sudo yum install Docker-ce
Second use of Alibaba cloud image
automatic installation using the official installation script Method 1
Curl-fssl https://get.docker.com | Bash-s Docker--mirror Aliyun
Method 2
CentOS 7 (install with Yum)
# step 1: Install some of the necessary system Tools sudo yum install-y yum-utils device-mapper-persistent-data lvm2 # step 2: Add software source information sudo yum-config-m Anager--add-repo Http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo # Step 3: Update and install Docker-ce sudo yum Makecache fast sudo yum-y install Docker-ce # Step 4: Open Docker services sudo service Docker start # Note: # The official software source is enabled by default with the latest software, which you can Edit the software source in a way that gets the various versions of the package. For example, the official does not have the test version of the software source to be available, you can open it by the following way.
In the same vein, various test versions can be opened. # Vim/etc/yum.repos.d/docker-ce.repo # Change the enabled=0 below [docker-ce-test] to enabled=1 # # Install the specified version of Docker-ce: # Step 1: Check Find 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.cen TOS @docker-ce-stable # docker-ce.x86_64 17.03.0.ce-1.el7.centos docker-ce-stable # A vailable Packages # StEP2: Install the specified version of Docker-ce: (version for example 17.03.0.ce.1-1.el7.centos above) # sudo yum-y install docker-ce-[version]
Installation Verification
root@izbp12adskpuoxodbkqzjfz:$ Docker version
Client:
version: 17.03.0-ce
API version: 1.26
Go version: go1.7.5
Git commit: 3a232c8
Built: Tue 07:52:04 os/arch
: Linux/amd64
Server:
version: 17.03.0-ce
API version: 1.26 (minimum version 1.12)
Go Version: go1.7.5
Git Commit: 3a232c8
Built: Tue Feb 07:52:04 os/arch
: linux/amd64
Experimental:false