前言
- CentOS Linux release 8.2
- CentOS Linux release 7.6
- 【Centos 8】【Centos 7】【Docker】 安装 RabbitMQ时,拉取docker IMAGE 阶段很慢。在国内,从 DockerHub 拉取镜像时经常会遇到这个问题。解决这个问题,除了等之外,还可以添加 DockerHub 的镜像地址提高拉取速度。
添加 DockerHub 的镜像地址
- 编辑 /etc/docker/daemon.json 内容如下(如果文件不存在手动创建):
shell> vi /etc/docker/daemon.json
{
"registry-mirrors":[
"https://reg-mirror.qiniu.com",
"https://hub-mirror.c.163.com",
"https://docker.mirrors.ustc.edu.cn"
]
}
或者:
shell> tee /etc/docker/daemon.json <<EOF
{
"registry-mirrors":[
"https://reg-mirror.qiniu.com",
"https://hub-mirror.c.163.com",
"https://docker.mirrors.ustc.edu.cn"
]
}
EOF
- 重启动docker服务:
shell> systemctl daemon-reload
shell> systemctl restart docker
- 查看加速器是否生效
shell> docker info
Client:
Debug Mode: false
Server:
Containers: 4
...
Registry Mirrors:
https://reg-mirror.qiniu.com/
https://hub-mirror.c.163.com/
https://docker.mirrors.ustc.edu.cn/
Live Restore Enabled: false