'docker-compose up' times out with UnixHTTPConnectionPool已解决

2019-09-20 06:21:05   Docker

ERROR: for ... UnixHTTPConnectionPool(host='localhost', port=None): Read timed out. (read timeout=60) An HTTP request took too long to complete. Retry with --verbose to obtain debug information. If you encounter this issue regularly because of slow network conditions, consider setting COMPOSE_HTTP_TIMEOUT to a higher value (current value: 60).

问题原因

出于各种原因(image堆叠的层太多、image内放了太多大文件或者其他不合理的操作)导致使用镜像启动一个容器的时候很慢很慢很慢很慢很慢...超过了docker-compose的默认timeout时间,docker client不能得到docker server的response,然后报错了:

ERROR: for ... UnixHTTPConnectionPool(host='localhost', port=None): Read timed out. (read timeout=60) An HTTP request took too long to complete. Retry with --verbose to obtain debug information. If you encounter this issue regularly because of slow network conditions, consider setting COMPOSE_HTTP_TIMEOUT to a higher value (current value: 60).

解决方法

所以我们只要设置一下timeout就好了呀

重启一波服务

sudo systemctl restart docker

设置环境变量

export DOCKER_CLIENT_TIMEOUT=120
export COMPOSE_HTTP_TIMEOUT=120

当然,你觉得120s不够,可以再大一点。

vien.tech版权所有,允许转载,但转载请注明出处和原文链接: https://viencoding.com/article/202
欢迎小伙伴们在下方评论区留言 ~ O(∩_∩)O
文章对我有帮助, 点此请博主吃包辣条 ~ O(∩_∩)O

猜你喜欢


评论

There are no comments yet.
未登录

登录后即可发表评论

登录或注册

亲情非友情链接