Detailed installation configuration of Docker

Posted by jasper on Mon, 14 Oct 2019 19:39:26 +0200

1. Configure yum source and install docker

[root@docker ~]# cd /etc/yum.repos.d/     #Switch to yum source directory
[root@docker yum.repos.d]# wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
#Download Ali's docker yum source library file
[root@docker yum.repos.d]# cd 
[root@docker ~]# yum makecache     #Establishing yum metadata cache
[root@docker ~]# yum repolist         #List available packages for the yum warehouse
                ......................#Omit part of content
docker-ce-stable/x86_64        Docker CE Stable - x86_64             58
#Make sure that docker... has a list of available packages, and I'm showing 58 (it doesn't matter if you want more or less, but you have to have this column, and it can't be zero)
[root@docker ~]# yum install -y docker-ce-18.09.0-3.el7 docker-ce-cli-18.09.0-3.el7 containerd.io-1.2.0-3.el7  
#yum installation docker

The explanation of containerd can be referred to as follows: containerd Interpretation

## If centos is a minimal installation, the following commands need to be executed to support automatic completion of Docker commands

[root@docker01 ~]# yum -y install bash-completion
[root@docker01~]# curl -L https://raw.githubusercontent.com/docker/compose/1.24.1/contrib/completion/bash/docker-compose -o /etc/bash_completion.d/docker-compose
[root@docker01 ~]# source /etc/bash_completion.d/docker-compose

2. Enabling the Acceleration Function of Downloading Mirror

Next, enable the download image acceleration function provided by Daoyun (Alibaba also provides this function, I will write about cloud here).
Dow Cloud Accelerator Web Site: https://www.daocloud.io/
The process is as follows:
(1) Visit the official website of Daoyun;
(2) Register users and log in;
After the first two steps are completed, please see the picture.

When you see the following interface, drag down the page:

Drag here and copy the commands according to your system version (copy the following line based on the Linux server):

[root@docker ~]# curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://f1361db2.m.daocloud.io
#Implement our copy command. Note: This command is different for everyone. Please copy it from the official page and execute it.
[root@docker ~]# systemctl daemon-reload
[root@docker ~]# systemctl restart docker
[root@docker ~]# systemctl enable docker
#After the accelerator operation is completed, an additional file will be added to the / etc/docker directory.
[root@docker ~]# cat /etc/docker/daemon.json   #This is the document related to acceleration.
{"registry-mirrors": ["http://f1361db2.m.daocloud.io"]}
[root@docker ~]# docker -v     #View the docker version
Docker version 18.09.0, build 4d60db4

———————— This is the end of the article. Thank you for reading.————————

Topics: Linux Docker yum CentOS