一、参考链接
https://blog.csdn.net/qq_46127735/article/details/120763669
https://docs.docker.com/engine/install/centos/
二、安装步骤
2.1、卸载旧版本的Docker
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
![](https://i-blog.csdnimg.cn/blog_migrate/c5c4dceb6568d8bbb3689234367feaa6.png)
2.2、安装yum-utils包
2.2.1、下载Docker所需的工具包
yum install -y yum-utils
![](https://i-blog.csdnimg.cn/blog_migrate/f9fe161880f6610b5936a53fe88cd630.png)
2.2.2、设置阿里云的Docker镜像仓库
yum-config-manager \
--add-repo \
https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
![](https://i-blog.csdnimg.cn/blog_migrate/6f1acc399acbaf4a60015c438969ef92.png)
2.3、更新yum软件包索引
yum makecache fast
![](https://i-blog.csdnimg.cn/blog_migrate/cc14e29167dc8e7ab7e908339637af0f.png)
2.4、安装最新版本的Docker Engine和containerd
yum install docker-ce docker-ce-cli containerd.io
![](https://i-blog.csdnimg.cn/blog_migrate/a369c38e14c657676184f3471c466679.png)
2.5、启动并运行Docker
# 启动Docker
systemctl start docker
# 通过运行hello world镜像验证docker引擎是否已经正确安装
docker run hello-world
# 设置docker开机自启动
systemctl enable docker
# 查看docker的版本号
docker version
# 查看下载的所有镜像
docker images
![](https://i-blog.csdnimg.cn/blog_migrate/873ccf5e9bc7771d439c51f7b8908ece.png)
![](https://i-blog.csdnimg.cn/blog_migrate/eac5db8c4a3ce8b821a06ef58d3b5af5.png)
2.6、配置镜像加速
# 配置镜像加速器
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": [
"https://dockerpull.com",
"https://docker.1panel.live",
"https://dockerproxy.cn",
"https://docker.hpcloud.cloud",
"https://r0xwsghc.mirror.aliyuncs.com",
"https://dockerhub.azk8s.cn",
"https://hub-mirror.c.163.com"
]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
# 说明:可以同时配置多个镜像加速地址
2.7、查看配置后的镜像
docker info
参考链接:
https://blog.csdn.net/lp840312696/article/details/125760053
![](https://i-blog.csdnimg.cn/blog_migrate/268b77658f2a50537de04324bb7a79f6.png)