compose: requests.exceptions.Timeout: UnixHTTPConnectionPool

Hi! I often get the following error on our Centos 6.5 server when executing docker-compose up -d:

Traceback (most recent call last):
  File "<string>", line 3, in <module>
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 31, in main
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 21, in sys_dispatch
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 27, in dispatch
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 24, in dispatch
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 59, in perform_command
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 155, in logs
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.project", line 205, in containers
  File "/code/build/docker-compose/out00-PYZ.pyz/docker.client", line 519, in containers
  File "/code/build/docker-compose/out00-PYZ.pyz/docker.client", line 81, in _get
  File "/code/build/docker-compose/out00-PYZ.pyz/requests.sessions", line 395, in get
  File "/code/build/docker-compose/out00-PYZ.pyz/requests.sessions", line 383, in request
  File "/code/build/docker-compose/out00-PYZ.pyz/requests.sessions", line 486, in send
  File "/code/build/docker-compose/out00-PYZ.pyz/requests.adapters", line 387, in send
requests.exceptions.Timeout: UnixHTTPConnectionPool(host='localhost', port=None): Read timed out. (read timeout=60)

Any idea what’s happening?

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Reactions: 1
  • Comments: 42

Most upvoted comments

Having the same issue with the following steps on a Jenkins CI build. The machine has been restarted, versions upgraded, after each build and run there is a cleanup script to stop/remove containers.

Building the image(s)

export COMPOSE_HTTP_TIMEOUT=120
cat compose.yml | envsubst | docker-compose -f - build app

Running the image(s)

export COMPOSE_HTTP_TIMEOUT=120
cat compose.yml | envsubst | docker-compose -f - up

Sample compose file:

version: '2'

services:
  mongodb:
    image: mongo:3.2.4
    ports:
      - "27017:27017"
    mem_limit: 1024m
    cpu_shares: 10
    networks:
      ntwk:
        aliases:
          - dbhost

  app:
    build: .
    image: domain/app:${DOCKER_IMAGE_TAG}
    ports:
      - "9000:9000"
    environment:
      - MONGODB_HOST=mongodb
    mem_limit: 7168m
    cpu_shares: 50
    depends_on:
      - mongodb
    networks:
    ntwk:
        aliases:
          - main-app

networks:
  ntwk:

Image sizes:

mongodb 600mb
app: 2.5gb

Versions

Docker version 1.11.1, build 5604cbe
docker-compose version 1.7.1, build 0a9ab35
docker-machine version 0.7.0, build a650a40

The following error message appears 50% of the time - this is happening on our Jenkins CI environment and also on our mac’s!

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

This is still a issue for us as well, it shows up every now and then, making packer deployments hard to consolidate:

https://github.com/umccr/infrastructure/blob/master/packer/stackstorm-ami/bootstrap-stackstorm.sh#L25

Running docker 17.10.1-ce and docker compose 1.19.0.

/cc @reisingerf

Hey guys, you can set the read timeout with

export DOCKER_CLIENT_TIMEOUT=120

Found here via code-search. Tested in our GitLab CI, which had the exact same problems, now running like a charm even with several concurrent builds.

Is this in the docs? Don’t think so 😃

Just saw this today as well.

Hi aberope.

Try:

COMPOSE_HTTP_TIMEOUT 600 docker-compose --verbose down

where you can change 600 for your needs.

Yes, Please more info. version of docker for example… Regards