在使用docker pull镜像时候,往往出现如下错误:docker: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers).
原因就是发现是因为docker加速器超时导致pull不下来。
问题如下
@ZBMac-C02F2R9QM npm run run:docker:csmongo
> codestream-server@1.0.0 run:docker:csmongo
> docker run -d -p 27017:27017 --name csmongo -v csmongodata:/data/db mongo:3.4.9
Unable to find image 'mongo:3.4.9' locally
3.4.9: Pulling from library/mongo
d13d02fa248d: Pull complete
289396365571: Pull complete
fa261f04fa67: Pull complete
6a367a82d0b7: Pull complete
15aa953ba1a9: Pull complete
193466d9d728: Downloading
95e75e2cec52: Download complete
111da4b346b0: Download complete
b1d5b8f25164: Downloading
4e5a96927e41: Downloading
b138ac1b5778: Downloading
docker: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers).
See 'docker run --help'.
解决方法
1、点击tabar栏中的docker图标,选择Preferences
2、选择Docker Engine项,在文本框中填下如下配置文章来源:https://www.toymoban.com/news/detail-544528.html
"insecure-registries": [
"10.0.0.12:5000"
],
"registry-mirrors": [
"https://docker.mirrors.ustc.edu.cn/",
"https://hub-mirror.c.163.com",
"https://registry.docker-cn.com"
]
Docker 官方中国区: https://registry.docker-cn.com
网易: http://hub-mirror.c.163.com
中科大: https://docker.mirrors.ustc.edu.cn
3、已按照上面配置完成后,重新执行pull文章来源地址https://www.toymoban.com/news/detail-544528.html
@ZBMac-C02F2R9QM npm run run:docker:csmongo
> codestream-server@1.0.0 run:docker:csmongo
> docker run -d -p 27017:27017 --name csmongo -v csmongodata:/data/db mongo:3.4.9
Unable to find image 'mongo:3.4.9' locally
3.4.9: Pulling from library/mongo
d13d02fa248d: Pull complete
289396365571: Pull complete
fa261f04fa67: Pull complete
6a367a82d0b7: Pull complete
15aa953ba1a9: Pull complete
193466d9d728: Pull complete
95e75e2cec52: Pull complete
111da4b346b0: Pull complete
b1d5b8f25164: Pull complete
4e5a96927e41: Pull complete
b138ac1b5778: Pull complete
Digest: sha256:97c51a36d08871557c02e64d20a9a6b645b16ce387b39ae4414609c39dfc439c
Status: Downloaded newer image for mongo:3.4.9
ababd2a2365dc15d313eb776b20a1836b957eae7dac8691cd781201da665f1d1
到了这里,关于如何修改Docker镜像地址的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!