1. Uninstall the old version
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
2. Install the yum-utils package (provide the yum-config-manager utility)
yum install -y yum-utils
3. Set up a stable repository (using Alibaba Cloud mirroring)
yum-config-manager \
--add-repo \
http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
Fourth, update the cache
yum makecache fast
5. Install the latest version of Docker Engine and container, or go to the next step to install a specific version
yum install docker-ce docker-ce-cli containerd.io
Six, start Docker
systemctl start docker
Seven, configure Docker
Docker's default mirror is a bit slow in terms of domestic origin, so you can configure the domestic mirror source to improve the pull speed
Alibaba Cloud Mirror Service Reference: https://cr.console.aliyun.com/cn-shanghai/instances/mirrors
1. Create a directory
mkdir -p /etc/docker
2. Create a mirror configuration file
vi /etc/docker/daemon.json
3. Add a mirror to the configuration file
{
"registry-mirrors":["http://hub-mirror.c.163.com"]
}
4. Reload the file and restart docker
sudo systemctl daemon-reload
systemctl restart docker
PS: some other accelerated sites
https://registry.docker-cn.com
http://hub-mirror.c.163.com
https://mirror.ccs.tencentyun.com
Eight, uninstall Docker
1. Uninstall Docker Engine, CLI and Containerd packages
yum remove docker-ce docker-ce-cli containerd.io
2. The images, containers, volumes or custom configuration files on the host will not be deleted automatically. To delete all images, containers and volumes
rm -rf /var/lib/docker