我在使用 docker-compose 启动容器过程中提示下面的错误:
ERROR: for docker-compose_zookeeper_1 UnixHTTPConnectionPool(host='localhost', port=None): Read timed out. (read timeout=70)
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)
而且还伴随着两条警告信息:
WARNING: The state variable is not set. Defaulting to a blank string.
WARNING: Connection pool is full, discarding connection: localhost
我使用的系统是 Ubuntu 20.04,2 块 CPU 16 核,32 G 内存。
根据提示,我尝试了下面的方法解决问题:
添加下列环境变量:
export COMPOSE_HTTP_TIMEOUT=500
export DOCKER_CLIENT_TIMEOUT=500
export COMPOSE_PARALLEL_LIMIT=1024
重置 docker 网络:
docker-compose down
docker network prune
docker-compose up -d
通过上面的方法,勉强可以启动容器服务,但仍然伴随着上面的警告信息,有时还会有超时失败的情况。
于是,我将安装系统的硬盘更换为一块固态硬盘,情况便更加好转了,但仍然伴随着上面的警告信息。
按理说,我的机器配置已经都不低了,并且整个服务启动占用内存也不到 8 G,系统完全能够承受,更诡异的是,我使用虚拟机(Ubuntu系统)进行测试,完全不会提示 WARNING: Connection pool is full, discarding connection: localhost(但由于虚拟机内存有限,容器启动后运行会不流畅或者宕掉)。
希望由大神可以解决疑问,不胜感谢。