docker需要拉取国内的镜像才能成功,拉取国外的有些网络被限制了会拉取不成功,建议用私人的阿里镜像
1. 公共镜像源
网易:http://hub-mirror.c.163.com 中科大镜像地址:http://mirrors.ustc.edu.cn/ 中科大github地址:https://github.com/ustclug/mirrorrequest Azure中国镜像地址:http://mirror.azure.cn/ Azure中国github地址:https://github.com/Azure/container-service-for-azure-china DockerHub镜像仓库: https://hub.docker.com/ 阿里云镜像仓库: https://cr.console.aliyun.com google镜像仓库: https://console.cloud.google.com/gcr/images/google-containers/GLOBAL (如果你本地可以翻墙的话是可以连上去的 ) coreos镜像仓库: https://quay.io/repository/ RedHat镜像仓库: https://access.redhat.com/containers
2. 私人阿里镜像加速器
这里采用了阿里云的镜像加速器(需要阿里云账号进行登录),地址:阿里云 -> 容器镜像服务 -> 镜像工具 -> 镜像加速器。
配置自己的docker
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://ckdhnbk9.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
sudo mkdir -p /etc/docker sudo tee /etc/docker/daemon.json <<-'EOF' { "registry-mirrors": ["https://ckdhnbk9.mirror.aliyuncs.com"] } EOF sudo systemctl daemon-reload sudo systemctl restart docker
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://ckdhnbk9.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
代码说明:
在/etc/docker目录下新建一个文件daemon.json,文件内容:
{
“registry-mirrors”: [“https://ckdhnbk9.mirror.aliyuncs.com”]
}
[]号里就是拉取阿里的仓库地址,多个地址用,号隔开
最新重新加载和重启docker就可以拉取了
sudo systemctl daemon-reload
sudo systemctl restart docker