1安装 Docker-CE社区版本
[root@Docker ]# yum -y install docker-ce
启动 Docker
[root@Docker ]# systemctl start docker
[root@Docker ]# systemctl enable docker
2 指定docker 镜像加速器 (很重要,不然后期从国外下载docker镜像会直接报错,而且速度慢)
国内docker仓库加速站点
https://registry.docker-cn.com
http://hub-mirror.c.163.com
https://3laho3y3.mirror.aliyuncs.com
http://f1361db2.m.daocloud.io
https://mirror.ccs.tencentyun.com
https://docker.mirrors.ustc.edu.cn
http://dockerhub.azk8s.cn/
配置加速节点
[root@Docker ]# vim /etc/docker/daemon.json
{
"registry-mirrors": ["https://registry.docker-cn.com" ]
}
3 重启相关服务
[root@Docker ]# systemctl daemon-reload
[root@Docker ]# systemctl restart docker && systemctl status docker
4 测试拉取 Docker 镜像
[root@Docker ]# docker image pull centos:latest
latest: Pulling from library/centos
8a29a15cefae: Pull complete
Digest: sha256:fe8d824220415eed5477b63addf40fb06c3b049404242b31982106ac204f6700
Status: Downloaded newer image for centos:latest
docker.io/library/centos:latest
#拉取 Docker 镜像成功
[root@Docker ]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
centos latest 470671670cac 2 months ago 237MB