https://www.jianshu.com/p/002c917d667a
问题:
本人正在使用docker运行一个中型的项目,包含40多个微服务及相关数据库的docker。由于docker-compose up 同时启动的服务过多,超过了请求HTTP限制的60s时间仍未全部成功启动起来,所以出现了超时错误:
ERROR: for xxx-gateway UnixHTTPConnectionPool(host='localhost', port=None): Read timed out. (read timeout=60)
ERROR: for xxx-gateway UnixHTTPConnectionPool(host='localhost', port=None): Read timed out. (read timeout=60)
ERROR: 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).
ERROR: 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).
其中60s是默认的时间。
解决思路:
把 COMPOSE_HTTP_TIMEOUT 的值调大,并转为环境变量即可。
解决步骤:
先进入/etc/profile配置文件,执行命令:
vi /etc/profile
然后在尾部添加上下面代码,设置成500秒:
export COMPOSE_HTTP_TIMEOUT=500
export DOCKER_CLIENT_TIMEOUT=500
接着使/etc/profile配置文件生效,执行命令:
source /etc/profile
查看环境变量是否生效:
echo $DOCKER_CLIENT_TIMEOUT
最后重新执行命令 docker-compose up 即可。
日期:2022年9月16日
转载出处并对内容进行了修改:
https://www.cnblogs.com/zhongyuanzhao000/p/11334190.html