[原创] Docker镜像拉取超时解决

由于GFW的原因,很多docker镜像拉取不到,连接超时或者各种报错。

像这样:

ERROR: failed to solve: node:18-alpine: failed to authorize: failed to fetch anonymous token: 
Get "<https://auth.docker.io/token?scope=repository%3Alibrary%2Fnode%3Apull&service=registry.docker.io>": dial tcp 103.56.16.112:443: i/o timeout

将docker的镜像源地址修改国内大厂的地址:

Docker Desktop这样改:

Linux这样改

vi /etc/docker/daemon.json

# 内容如下:
{
  "registry-mirrors": [
    "<https://xx4bwyg2.mirror.aliyuncs.com>",
    "<http://f1361db2.m.daocloud.io>",
    "<https://registry.docker-cn.com>",
    "<http://hub-mirror.c.163.com>",
    "<https://docker.mirrors.ustc.edu.cn>"
  ]
}

也不行,报错像下面这样:

ERROR: failed to solve: node:18-alpine: failed to do request: 
Head "<https://hub-mirror.c.163.com/v2/library/node/manifests/18-alpine?ns=docker.io>": EOF

最后,找到一个镜像代理,可以把你需要的镜像拉到Docker,比如之前拉取node镜像docker.io/library/node:18-alpine 失败,只需要输入node:18-alpine ,然后获取命令,一步步执行就好

发表回复

Copyright © 2024 aiapaas.com 粤ICP备 18086566号