`docker-compose up` 超时并显示 UnixHTTPConnectionPool 错误。

huangapple go评论106阅读模式
英文:

`docker-compose up` times out with UnixHTTPConnectionPool

问题

在我们的Jenkins代理中,我们运行大约20个测试,其设置涉及运行docker-compose up来启动大约14个服务/容器。

偶尔,我会遇到以下错误:

ERROR: for testdb-data  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).

我无法稳定地重现这个问题。我还在尝试弄清楚我们的代理资源是否被充分使用与此有关。

docker -v1.10.1docker-compose -v1.13.1

对于这个问题,有什么想法吗?

英文:

In our Jenkins agents we are running about several (around 20) tests whose setup involves running docker-compose up for a "big" number of services/containers (around 14).

From time to time, I'll get the following error:

ERROR: for testdb-data  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).

Haven't been able to reproduce this consistently. And I'm still trying to figure out whether or not there is a correlation with our agent's resources being at full use.

docker -v is 1.10.1 and docker-compose -v is 1.13.1.

Any ideas about what this may be related to?

答案1

得分: 80

重新启动Docker服务:

sudo systemctl restart docker

并设置DOCKER_CLIENT_TIMEOUTCOMPOSE_HTTP_TIMEOUT环境变量:

export DOCKER_CLIENT_TIMEOUT=120
export COMPOSE_HTTP_TIMEOUT=120

目前有两种解决方法。

相关问题链接如下:

https://github.com/docker/compose/issues/3927

https://github.com/docker/compose/issues/4486

https://github.com/docker/compose/issues/3834

英文:

Restarting docker service:

sudo systemctl restart docker

and setting DOCKER_CLIENT_TIMEOUT and COMPOSE_HTTP_TIMEOUT environment variables:

export DOCKER_CLIENT_TIMEOUT=120
export COMPOSE_HTTP_TIMEOUT=120

are two workarounds for now.

Related issues are:

https://github.com/docker/compose/issues/3927

https://github.com/docker/compose/issues/4486

https://github.com/docker/compose/issues/3834

答案2

得分: 18

我遇到了同样的问题。在将 max-file 大小的值从数字更改为字符串后,问题得到了解决。

错误的配置:

logging:
 options:
       max-file: 10
       max-size: 10m

正确的配置:

logging:
 options:
       max-file: "10"
       max-size: 10m
英文:

I had the same problem. It was solved after change the max-file size value from a number to a string.

Wrong config

logging:
 options:
       max-file: 10
       max-size: 10m

Correct config

logging:
 options:
       max-file: "10"
       max-size: 10m

答案3

得分: 9

docker-compose down命令用于停止并移除Compose文件中定义的容器。运行docker-compose down,然后再运行docker-compose up --build可能会起作用。我在使用VSCode构建Docker时遇到类似问题时,这个解决方案对我有效。

在执行上述命令之前,最好参考一下什么是docker-compose down的目的

英文:
docker-compose down

Running docker-compose down and then running docker-compose up --build may work. I am working on vscode and when I encountered a similar problem while building docker, this solution worked for me.

Before performing above mentioned command its better you refer to what is the purpose of docker-compose down

答案4

得分: 6

docker-compose restart
修复了我的问题。这将重新启动所有已停止和正在运行的服务。

英文:
docker-compose restart

Fixed my issue. This will restart all stopped and running services.

答案5

得分: 0

以下是翻译好的内容:

docker-compose down
export DOCKER_CLIENT_TIMEOUT=120
export COMPOSE_HTTP_TIMEOUT=120

docker-compose up -d

以下步骤有效
英文:
docker-compose down
export DOCKER_CLIENT_TIMEOUT=120
export COMPOSE_HTTP_TIMEOUT=120

docker-compose up -d

following steps worked

答案6

得分: -2

有时候这可能是由于Docker内部缓存引起的,对我来说以下步骤有效:

1:docker-compose down -v --rmi all --> 删除所有镜像和缓存

2:docker-compose up --build

英文:

sometimes it could because of docker internal cache, for me following steps worked:

1: docker-compose down -v --rmi all --> to remove all the image and cache

2: docker-compose up --build

huangapple
  • 本文由 发表于 2017年2月14日 23:50:32
  • 转载请务必保留本文链接:https://go.coder-hub.com/42230536.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定