docker / compose

Define and run multi-container applications with Docker
https://docs.docker.com/compose/
Apache License 2.0
33.87k stars 5.21k forks source link

UnixHTTPConnectionPool(host='localhost', port=None): Read timed out. (read timeout=60) #3927

Closed boda-sh closed 1 year ago

boda-sh commented 8 years ago

Hi since yesterday I've been running into this error while doing docker-compose up

Full Error Message

Device-Tracker $ docker-compose up
Creating device-tracker-db
Creating device-tracker

ERROR: for web  UnixHTTPConnectionPool(host='localhost', port=None): Read timed out. (read timeout=60)
Traceback (most recent call last):
  File "<string>", line 3, in <module>
  File "compose/cli/main.py", line 61, in main
  File "compose/cli/main.py", line 113, in perform_command
  File "contextlib.py", line 35, in __exit__
  File "compose/cli/errors.py", line 56, in handle_connection_errors
TypeError: log_timeout_error() takes exactly 1 argument (0 given)
docker-compose returned -1

Docker Version Docker for Mac: 1.12.0-a (Build 11213) Machine info MacBook Air (13-inch, Early 2015) Processor: 1.6 GHz i5 Memory: 4GB 1600 MHz DDR3 macOS: Version 10.11.6 (Build 15G1004)

Attempts

kevinquillen commented 3 years ago

How did you get that? Opening Docker on Mac and doing "Check for Updates" still says I have the latest, 2.4.2.0.

EricVogl-carta commented 3 years ago

I've just upgraded to last Docker for Mac version (v2.5.0.1) and the problem seems to be solved. No more UnixHTTPConnection error, and no more 100% CPU use.

Not sure if anyone else can confirm that.

I just experienced the issue on v2.5.0.1. Restarting docker seems to (at least temporarily) resolve the issue.

samoritano commented 3 years ago

How did you get that? Opening Docker on Mac and doing "Check for Updates" still says I have the latest, 2.4.2.0.

I cannot show you any screenshot since I already upgraded, but I think you may have some trouble getting updates from your computer, since there have been a previous v2.5.0 version available for more than a week.

You can check it in the Docker for Mac release notes (and grab any new installer from there).

kevinquillen commented 3 years ago

I'm running Edge. That probably explains it.

stoutput commented 3 years ago

Can confirm that v2.5.0.1 is at least marginally better. Not getting timeouts at every boot anymore, and haven't run into it yet since updating this morning. Container boot time still seems much slower than 2.3, though.

Edit: just ran into the timeout errors again, after about 4 or 5 restarts of my docker-compose project. Also ran into a new error with 2.5.0.1: Cannot start service <container name>: error while creating mount source path <local mount path>: mkdir <local mount path>: file exists

samoritano commented 3 years ago

Can confirm that v2.5.0.1 is at least marginally better. Not getting timeouts at every boot anymore, and haven't run into it yet since updating this morning. Container boot time still seems much slower than 2.3, though.

Edit: just ran into the timeout errors again, after about 4 or 5 restarts of my docker-compose project. Also ran into a new error with 2.5.0.1: Cannot start service <container name>: error while creating mount source path <local mount path>: mkdir <local mount path>: file exists

OK, I'm also still facing some problems with 2.5.0.1 version. CPU usage is still too high compared to v2.3.x, and the speed is also pretty slow.

kevinquillen commented 3 years ago

Can anyone from the Docker team acknowledge and weigh in on this?

leapit commented 3 years ago

God,4 years passed,this issue still not solved,and it happens to me all the time

azoff commented 3 years ago

Same, +1 - hurting our whole org.

dmerrick commented 3 years ago

I just had this issue on a (headless) Mac, and it turns out I needed to click a prompt enabling access to a network drive. Once I did that, everything worked as expected!

Ostendorf commented 3 years ago

I have this same issue, but the only thing that fixes it for me is downgrading to 2.3.0.5.

I tried 2.4.0.0 and today 2.5.0.1, but those do not work for my setup. My setup has a docker-compose file with 41 docker images that all start together. 2.3 starts them fine. The newer versions break the startup process after successfully starting around 30 images. After that I cannot even start one extra via command line or docker dashboard. Docker engine seems unresponsive and gives the timeouts. Increasing timeout time or restarting docker/macOS does not help. Docker already has access to 6 CPUs, 16GB RAM, 1GB swap and 60GB SSD (8GB used). OS: macOS Catalina 10.15.7

angelomelonas commented 3 years ago

This started happening to me on Docker for Mac since I updated to Docker 3.0.0 today (whenever I do docker-compose up). Restarting Docker for Mac fixes it, but only allows me to do docker-compose up a few times before having to restart it again.

mfawzy1 commented 3 years ago

I faced the same issue and it's solved for me when I removed dangling images using the below command docker rmi $(docker images --filter "dangling=true" -q --no-trunc)

ConfidenceYobo commented 3 years ago

FWIW: For the people landing here through search engine finding their resolvement, I've been able to fix this simply by the did you try turning it off and on again? method; I've restarted my Docker Mac OS client.

Restarting docker solved the issue for me.

Keegan-y commented 3 years ago
for mac restart docker:

➜  ~ launchctl list | grep docker
-   0   com.docker.helper
1990    0   application.com.docker.docker.715810.716504
➜  ~ launchctl stop application.com.docker.docker.715810.716504 && launchctl start application.com.docker.docker.715810.716504 
Keegan-y commented 3 years ago

Q:docker.errors.DockerException: Error while fetching server API version: UnixHTTPConnectionPool(host='localhost', port=None): Read timed out. (read timeout=60)

A:for Apple M1 Tech Preview: I tried to reboot, uninstall and reinstall, and eventually uninstall and reinstall solved the problem. down link:https://docs.docker.com/docker-for-mac/apple-m1/

rvanbaalen commented 3 years ago

Like @angelomelonas said; this started happening when I upgraded to Docker for Mac 3.* and is still happening. I restart docker, it runs fine a couple of times, and then it happens again. Really killing productivity.

AlexZeitler commented 3 years ago

@rvanbaalen @angelomelonas My colleagues and me have downgraded to 2.3.0.5 because of this.

cullylarson commented 3 years ago

I'm getting this issue too (macos, Docker Desktop 3.2.2). I'm mounting my project folder as a volume. Strangely if I remove my .git folder from the project, everything works fine.

JoeCap08055 commented 3 years ago

Had been running 2.3.0.5 to avoid this issue, but after the latest MacOS upgrade to 11.3, Docker 2.3.x won't run anymore. Now running 3.3.1 and experiencing this issue.

rvanbaalen commented 3 years ago

Had been running 2.3.0.5 to avoid this issue, but after the latest MacOS upgrade to 11.3, Docker 2.3.x won't run anymore. Now running 3.3.1 and experiencing this issue.

Just download the latest 2.* release. I believe from the top of my head its 2.5.something.

Im running 2.x on 11.3

JoeCap08055 commented 3 years ago

Had been running 2.3.0.5 to avoid this issue, but after the latest MacOS upgrade to 11.3, Docker 2.3.x won't run anymore. Now running 3.3.1 and experiencing this issue.

Just download the latest 2.* release. I believe from the top of my head its 2.5.something.

Im running 2.x on 11.3

My understanding was that this was an issue for all verisons > 2.3.x (ie, 2.4, 2.5, 3.x)

cullylarson commented 3 years ago

@JoeCap08055 I reverted back to Docker Desktop 2.5.0.1 and I don't have the issue.

Ostendorf commented 3 years ago

Had been running 2.3.0.5 to avoid this issue, but after the latest MacOS upgrade to 11.3, Docker 2.3.x won't run anymore. Now running 3.3.1 and experiencing this issue.

I had this same issue. Was running 2.3.0.5 for a long time because all upgrades failed to run our docker compose setup. After upgrading to macOS 11.3 (from 10.x), Docker stopped working completely. I tried the latest 3.x without any good results. So now I've downgraded even further to 2.2.0.5 and this version works for me again. What a complete mess. Maybe we should go back to Vagrant...

JoeCap08055 commented 3 years ago

FYI, downgrading to 2.2.0.5 worked for me.

rvanbaalen commented 3 years ago

FYI, downgrading to 2.2.0.5 worked for me.

Have you tried the 2.5.x version as well?

JoeCap08055 commented 3 years ago

Haven't tried 2.5.x. Maybe I will at some point, but for now I've got a functional setup and lots of work to do...

beporter commented 3 years ago

Okay this is ridiculous, but this Stackoverflow answer is what actually fixed it for me.

If you have any logging: options: max-file: 10 entries in your docker-compose.yml, try making them strings:

logging:
  options:
    #max-file: 10  # bad
    max-file: '10' # good

EDIT:

$ docker version
Client: Docker Engine - Community
 Cloud integration: 1.0.12
 Version:           20.10.5
 API version:       1.41
 Go version:        go1.13.15
 Git commit:        55c4c88
 Built:             Tue Mar  2 20:13:00 2021
 OS/Arch:           darwin/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.5
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       363e9a8
  Built:            Tue Mar  2 20:15:47 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.4
  GitCommit:        05f951a3781f4f2c1911b05e61c160e9c30eaa8e
 runc:
  Version:          1.0.0-rc93
  GitCommit:        12644e614e25b05da6fd08a38ffa0cfe1903fdec
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
M2G commented 3 years ago

@beporter It works for me, thank you !

tangopium commented 3 years ago

@beporter Unfortunately, it doesn't work for me. I don't have logging configured in my docker-compose.yml and even explicitly adding it still results in the same problem.

Sloth-on-meth commented 3 years ago

encountering this issue as well, still no solution??????

AlexZeitler commented 3 years ago

@rvanbaalen @angelomelonas My colleagues and me have downgraded to 2.3.0.5 because of this.

As described by @Ostendorf now I had to downgrade to 2.2.0.5 to make it work on the latest version of Big Sur.

NoSkillGuy commented 3 years ago

I am running docker desktop 3.3.3 and still the same issue exists.

TristanMalbran commented 3 years ago

Docker 3.5.2 and seeing the same issue

jsilberm commented 3 years ago

I have a data point.
Seeing the same error consistently on GCP with n2-standard-16 and bigger. NOT seeing the same error consistently on GCP with n2-standard-8. FWIW ...

phuang07 commented 3 years ago

FYI, downgrading to 2.2.0.5 worked for me.

Have you tried the 2.5.x version as well?

I have downgrade to docker 2.5.1, it works for a day and then it stops working again. This is especially troubling if you switching between VPN within corporate networks.

I don't have this issue prior upgrading to Big Sur.

nirajgadhe commented 3 years ago

I got this error due to low memory issues

I tried below command echo 1 > /proc/sys/vm/drop_caches

After which everything worked properly

davidjamesstone commented 3 years ago

I have been plagued by this for months. Running Docker 3.3 on MacOS Big Sur. Usually, I just restart docker when it happens (about once / day).

Today though, it happen 5 times in 1 hour so I wanted to try and sort it once and for all.

In docker settings, I enabled "Use gRPC FUSE for file sharing" (I remembered this fixing something Mac related in the past) and it hasn't happened since. 🤞

I hope this helps someone else.

Megidd commented 3 years ago

For me, it was fixed by creating a 6 GB swap partition for a system with 1 GB RAM:

https://aws.amazon.com/premiumsupport/knowledge-center/ec2-memory-swap-file/

I ran into this error when setting up mailcow by docker and docker-compose following this and that.

nicolasparada commented 3 years ago

I got the same issue after adding loki plugin.

docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions

What I did was disabled the plugin:

docker plugin disable loki --force

and then I was able to stop the containers without issues.

docker-compose down

I just enabled it back before going up again.

docker plugin enable loki
docker-compose up -d

I hope it works for some of you at least.

thrubovc commented 3 years ago

Forget the stupid "turn it off and on again" advice or systemctl restart docker.service, they won't fix the problem, it'll happen again in the future. You need to configure docker to wait longer for the task that's taking too much time, that's all. Add these parameters into your docker service file under the [Service] section:

Environment="DOCKER_CLIENT_TIMEOUT=120"
Environment="COMPOSE_HTTP_TIMEOUT=120"
raphael-leger commented 3 years ago

On macOS, I spent hours on this issue and what worked for me was to upgrade Docker Dekstop to v4.1.1.

Before that I had tried to restart the docker client, docker services, I increased the timeout values of DOCKER_CLIENT_TIMEOUT , COMPOSE_HTTP_TIMEOUT, I gave a lot of memory and CPUs to Docker, I pruned every images/volumes/containers, I uninstalled Docker entirely. Nothing worked. Then I simply updated Docker Desktop to v4.1.1 and the error message went away.

lorezi commented 3 years ago

This worked for me on macOS, when I ran the following bash command export DOCKER_CLIENT_TIMEOUT=120 export COMPOSE_HTTP_TIMEOUT=120

carlosvinter commented 3 years ago

On macOS, I spent hours on this issue and what worked for me was to upgrade Docker Dekstop to v4.1.1.

Before that I had tried to restart the docker client, docker services, I increased the timeout values of DOCKER_CLIENT_TIMEOUT , COMPOSE_HTTP_TIMEOUT, I gave a lot of memory and CPUs to Docker, I pruned every images/volumes/containers, I uninstalled Docker entirely. Nothing worked. Then I simply updated Docker Desktop to v4.1.1 and the error message went away.

Updating docker worked for me after trying everything above. macOS Big Sur

ethanabrooks commented 3 years ago

The cause of this issue in my case was a very large .git directory which I was including in my project. I was working with a very old project with a lot of branches and history, much of which was no longer relevant, so I was able to initialize a new repository with an empty history. In my case that solved the problem.

Perhaps in general, this issue crops up for larger docker images.

jfortier-haptiq commented 2 years ago

Okay this is ridiculous, but this Stackoverflow answer is what actually fixed it for me.

If you have any logging: options: max-file: 10 entries in your docker-compose.yml, try making them strings:

logging:
  options:
    #max-file: 10  # bad
    max-file: '10' # good

Ridiculous is right. Holy moly, I've been trying to fix this issue all afternoon. Thanks!

vincentyang-plus commented 2 years ago

For my case, it is aws cloudwatch log component failed, and container cannot start. check your docker daemon log, it can tell what failed and why it cannot start, resolve that problem first.

journalctl -u docker.service 

Everyone could have different failure reason.

Airstriker commented 2 years ago

I got this error due to low memory issues

I tried below command echo 1 > /proc/sys/vm/drop_caches

After which everything worked properly

That was it. Indeed the cache occupied the full memory. Dropping it helped immediately. Thanks!

Gustl22 commented 2 years ago

Also running docker without sudo priviledges led to this error message (on Raspberry PI 4). The error logging definitely should be improved in that case.

Constantin07 commented 2 years ago

Still experiencing this issue on MacOS BigSur 11.6.2 with:

Docker Desktop 4.5.0 (74594)
Engine: 20.10.12
Compose: 1.29.2