net/http: request canceled while waiting for connection或者 net/http: TLS handshake timeout.

补充:不推荐在Windows下使用docker,在实际使用过程中:

1. 出现如端口某明奇妙被占用,文件被占用,重启docker.server才能解决,

2. 还出现过link的container在command中无法连接,但是进入容器内部连接却没有问题(network方式没有尝试)

--------

windows 10 下安装docker desktop:

拉取nginx测试:docker pull nginx

报错:Get https://registry-1.docker.io/v2/: net/http: TLS handshake timeout.

配置国内镜像加速:参考:https://www.daocloud.io/mirror#accelerator-doc

加入:http://f1361db2.m.daocloud.io

早期的版本稍微有点不同,大同小异:daemon里面配置

出现一个恶心的提示:

Image docker.io/library/nginx:latest uses outdated schema1 manifest format. Please upgrade to a schema2 image for better future compatibility. More information at https://docs.docker.com/registry/spec/deprecated-schema-v1/

继续报错:看地址好像没配置成功,但明明应该是配置没问题的。

Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

再次更换"registry-mirrors",使用:["http://hub-mirror.c.163.com"]

再次执行docker pull nginx ,正常。

默认新版windows docker 会自带docker-compose,如果docker-compose up 的时候出现如上报错,那么先使用docker pull拉取镜像再使用docker-comopse命令即可。

总结:

修改registry-mirrors ,使用http://hub-mirror.c.163.com(本次使用) 或者 https://docker.mirrors.ustc.edu.cn (没测试)

也可以使用阿里云:https://yc9s9bvm.mirror.aliyuncs.com(地址可能会变)

 

1. 其他报错:the input device is not a TTY.  If you are using mintty, try prefixing the command with 'winpty'

使用:winpty docker exec -it 0e8581469f12 /bin/bash

2. 继续报错:OCI runtime exec failed: exec failed: container_linux.go:349: starting container process caused "exec: \"C:/Program Files/Git/usr/bin/bash.exe\": stat C:/Program Files/Git/usr/bin/bash.exe: no such file or directory": unknown

解决:把/bin/bash改为:bash 命令:winpty docker exec -it 0e8581469f12 bash

 

  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值