0、简单说明
使用docker阿里云镜像,需要首先登陆阿里云账户才行,搜索:容器镜像服务,然后docker示例地址如下:
https://***.mirror.aliyuncs.com
每个人的***,都不一样。
1、阿里云官方文档
针对Docker客户端版本大于 1.10.0 的用户
您可以通过修改daemon配置文件/etc/docker/daemon.json来使用加速器
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://etarl33.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
2、docker配置完阿里云镜像后,报如下错误:
[root@localhost docker]# systemctl restart docker
Job for docker.service failed because start of the service was attempted too often. See "systemctl status docker.service" and "journalctl -xe" for details.
To force a start use "systemctl reset-failed docker.service" followed by "systemctl start docker.service" again.
重启失败!
3、解决方案
daemon.json配置错误了,只复制:
"registry-mirrors": ["https://etarl33.mirror.aliyuncs.com"]
这是个json文件,少了大括号,daemon.json内容为:
{
"registry-mirrors": ["https://etarl33.mirror.aliyuncs.com"]
}