Windows版Docker Desktop教程首命令失败:镜像拉取超时求助
解决Windows Docker Desktop拉取镜像超时问题
执行命令:
docker run --name repo alpine/git clone https://github.com/docker/getting-started.git报错信息:
Unable to find image 'alpine/git:latest' locally docker: Error response from daemon: Get "https://registry-1.docker.io/v2/": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers). See 'docker run --help'.
问题核心是Docker默认镜像仓库访问超时,导致无法拉取alpine/git镜像,以下是可行的解决方法:
配置国内镜像源
- 打开Docker Desktop,点击右上角齿轮图标进入设置。
- 切换到
Docker Engine选项卡,在JSON配置中添加国内镜像源,示例配置如下:"registry-mirrors": [ "https://hub-mirror.c.163.com", "https://mirror.baidubce.com", "https://docker.mirrors.ustc.edu.cn" ] - 点击
Apply & Restart,等待Docker重启完成配置生效。
手动拉取镜像后执行命令
若配置镜像源后仍有问题,可先单独拉取目标镜像:docker pull alpine/git:latest拉取成功后再执行原命令即可。
检查网络与代理设置
- 确认本地网络可正常访问外网,尝试ping
registry-1.docker.io验证连通性。 - 若使用代理,需在Docker Desktop的
Proxy设置中配置对应代理信息,确保Docker能通过代理访问镜像仓库。
- 确认本地网络可正常访问外网,尝试ping
内容的提问来源于stack exchange,提问作者eastwater
相关产品推荐
相关产品推荐

