How to override the default value of COMPOSE_HTTP_TIMEOUT with docker-compose command

DockerDocker Compose

Docker Problem Overview


I have docker-compose which fetches some of the images and builds one. When I run docker-compose up , I am getting the following error

> 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).

Question: How to pass the COMPOSE_HTTP_TIMEOUT with docker-compose command?

Docker Solutions


Solution 1 - Docker

COMPOSE_HTTP_TIMEOUT is an environment variable, so

COMPOSE_HTTP_TIMEOUT=200 docker-compose up

Solution 2 - Docker

You need your COMPOSE_HTTP_TIMEOUT at your docker instance level (docker-compose up) and not inside your docker image. So the solution is to create a .env file and put this inside:

#.env
COMPOSE_HTTP_TIMEOUT=200

you can check the doc [here][1]

[1]: https://docs.docker.com/compose/env-file/ "here"

Solution 3 - Docker

For Mac users, restarting docker from the status bar icon fixed this issue:

Restarting Docker

Solution 4 - Docker

restart the docker

command: sudo service docker restart

then try docker-compose up

Solution 5 - Docker

I faced this issue recently. Even after overriding the default COMPOSE_HTTP_TIMEOUT value it did not work for me.

Possible cause As mentioned in documentation Compose CLI environment variables

> COMPOSE_HTTP_TIMEOUT: Configures the time (in seconds) a request to the Docker daemon is allowed to hang before Compose considers it failed. Defaults to 60 seconds.

Removing the tty:true from my docker-compose worked for me.

More details on the issueCompose error "HTTP request took too long to complete" #3633

Docker Environment details:

$ docker-compose version

docker-compose version 1.18.0, build 8dd22a9
docker-py version: 2.6.1
CPython version: 2.7.13
OpenSSL version: OpenSSL 1.0.1t  3 May 2016



$ docker version
Client:
 Version:           18.09.1
 API version:       1.39
 Go version:        go1.10.6
 Git commit:        4c52b90
 Built:             Wed Jan  9 19:35:01 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.1
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.6
  Git commit:       4c52b90
  Built:            Wed Jan  9 19:06:30 2019
  OS/Arch:          linux/amd64
  Experimental:     false

Solution 6 - Docker

Add this one in .env file: COMPOSE_HTTP_TIMEOUT=1000

Solution 7 - Docker

Open terminal and type following command

COMPOSE_HTTP_TIMEOUT=200

To verify type

echo $COMPOSE_HTTP_TIMEOUT

Output: 200

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
QuestiongurubelliView Question on Stackoverflow
Solution 1 - DockerdnephinView Answer on Stackoverflow
Solution 2 - Dockerdzof31View Answer on Stackoverflow
Solution 3 - DockerMaroun MelhemView Answer on Stackoverflow
Solution 4 - DockerAbdullahView Answer on Stackoverflow
Solution 5 - DockerAkshay barahateView Answer on Stackoverflow
Solution 6 - DockerWQTMView Answer on Stackoverflow
Solution 7 - DockerAhsan HoraniView Answer on Stackoverflow