`docker-compose up` times out with UnixHTTPConnectionPool

GoDockerDocker Compose

Go Problem Overview


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?

Go Solutions


Solution 1 - Go

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. But the issues are still open in docker compose github:

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

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

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

Solution 2 - Go

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

Solution 3 - Go

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

Solution 4 - Go

docker-compose restart

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

Solution 5 - Go

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionjleeothonView Question on Stackoverflow
Solution 1 - GosajjadGView Answer on Stackoverflow
Solution 2 - GoYorubaView Answer on Stackoverflow
Solution 3 - GoSrihitha_30View Answer on Stackoverflow
Solution 4 - GoyidoView Answer on Stackoverflow
Solution 5 - GoHarsh SrivastavaView Answer on Stackoverflow