The environment

  • CentOS 8
  • Install using YUM

Installing dependency packages

sudo yum install -y yum-utils  device-mapper-persistent-data  lvm2
Copy the code

Set up the stable release repository

1. Official (slow download not recommended)

sudo yum-config-manager  --add-repo  https://download.docker.com/linux/centos/docker-ce.repo
Copy the code

2. Aliyun in China (recommended)

sudo yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
Copy the code

The installation

1. Install the latest version

 

sudo yum install docker-ce
Copy the code

2. Install the specified version

View all versions

yum list docker-ce --showduplicates | sort -r
Copy the code

Sudo yum install docker-ce-

docker-ce-18.09.1

Sudo yum install docker - ce - 18.09.1Copy the code

View the Docker version

docker version
Copy the code

Start the Docker

systemctl start docker
Copy the code

Stop the Docker

systemctl stop docker
Copy the code

Uninstall the Docker

sudo yum remove docker-ce
Copy the code

Configuring Mirror Acceleration

The main idea is to add a mirror address to /etc/docker-daemon. json or create one yourself

mkdir -p /etc/docker
Copy the code
vim /etc/docker/daemon.json
Copy the code

Daemon. json add the following:

Ali cloud

{"registry-mirrors": ["https://1lnz32yq.mirror.aliyuncs.com"]}
Copy the code

Netease cloud

{"registry-mirrors": ["https://hub.mirror.c.163.com"]}
Copy the code

Reload the

systemctl daemon-reload
Copy the code

Restart the Docker

systemctl restart docker
Copy the code