compose: UnixHTTPConnectionPool(host='localhost', port=None): Read timed out. (read timeout=60)
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
- Everything still works on colleagues’ machine, they are using MacBook Pro
- Increased Docker CPU from 2 to 3, and 2GB RAM to 3GB, still error
- Removed All Docker containers & images, and rebuild everything, still error
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 182
- Comments: 163 (1 by maintainers)
Links to this issue
Commits related to this issue
- Add docker timeouts for tty https://github.com/docker/compose/issues/3927 https://github.com/docker/compose/issues/3106 https://github.com/docker/compose/issues/2338 https://github.com/docker/docker-... — committed to astronomer/airflow by tedmiston 7 years ago
- #667, move away from ansible timeout to env vars docker_services' (of ansible) timeout didn't appear to effect the timeout in use. Setting COMPOSE_HTTP_TIMEOUT env variable for all docker_services u... — committed to Abelaa/pcmt by joshzamor 4 years ago
- [PGPRO-3182] Increase timeout to docker socket in tests. Sometimes docker seems to randomly hang, see https://github.com/docker/compose/issues/3927 tags: multimaster — committed to postgrespro/mmts by arssher 4 years ago
- Add docker-compose for the SonarQube If `docker-compose up -d` occurred error as follow ERROR: for sonar_db_1 UnixHTTPConnectionPool(host='localhost', port=None): Read timed out. (read timeou... — committed to llama90/infra-snippet by llama90 3 years ago
- Docker-compose timeout bug workaround https://github.com/docker/compose/issues/3927 — committed to d3vilh/raspberry-gateway by d3vilh a year ago
- Right way to fix docker-compose timeout bug workaround https://github.com/docker/compose/issues/3927 — committed to d3vilh/raspberry-gateway by d3vilh a year ago
- Correct way to fix docker-compose timeout bug workaround https://github.com/docker/compose/issues/3927 — committed to d3vilh/raspberry-gateway by d3vilh a year ago
- Docker-compose timeout bug workaround https://github.com/docker/compose/issues/3927 — committed to d3vilh/raspberry-gateway by d3vilh a year ago
- Right way to fix docker-compose timeout bug workaround https://github.com/docker/compose/issues/3927 — committed to d3vilh/raspberry-gateway by d3vilh a year ago
- Correct way to fix docker-compose timeout bug workaround https://github.com/docker/compose/issues/3927 — committed to d3vilh/raspberry-gateway by d3vilh a year ago
- Docker-compose timeout bug workaround https://github.com/docker/compose/issues/3927 — committed to d3vilh/raspberry-gateway by d3vilh a year ago
- Right way to fix docker-compose timeout bug workaround https://github.com/docker/compose/issues/3927 — committed to d3vilh/raspberry-gateway by d3vilh a year ago
- Correct way to fix docker-compose timeout bug workaround https://github.com/docker/compose/issues/3927 — committed to d3vilh/raspberry-gateway by d3vilh a year ago
tried this
and it seems to fix the issue for now
Other solutions people mentioned in this thread:
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 works to me.
God,4 years passed,this issue still not solved,and it happens to me all the time
@rodrigo-brito restarting is not a solution…
Restart is not a fix guys… How to avoid this for good?
A simple
sudo service docker restart
solves this for me consistently every time it occurs.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 dodocker-compose up
a few times before having to restart it again.+1 I am seeing this timeout issue every single week, usually after an idle weekend, while I was trying to connect to me containers, it timed out… I have to terminate the running docker proc and restart it to work around…
From different attempts at working around this, I found something that might shed some light on a possible fix:
At first my scenario looked a bit like this:
My mounted path included many directories with big, static files that I didn’t really need mounted in terms of code reloading. So i ended up swapping for something like this:
This left out of the runtime mounting all my big static files, which made the service start way faster.
What I understand from this is: the more files you mount, especially the larger they are (images in the MBs instead of source files in the Bs/KBs), loading times go up by a lot.
Hope this helps
I’m seeing exactly the same problem with latest beta for Mac. Same error if I run
docker-compose create
Could this be related to having one very large layer in the image? (a very lengthy
npm install
operation that takes about a minute to be flattened into a layer when docker builds the image)Happinging with a
nginx
conatiner,Up 47 hours
. Docker for macVersion 17.03.1-ce-mac12 (17661) Channel: stable d1db12684b
.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:just happend to our server, open issue since 2016, wtf
my man.
Happened to me because of a large port range, it actually creates one rule per port…
I got the same issue after adding loki plugin.
What I did was disabled the plugin:
and then I was able to stop the containers without issues.
I just enabled it back before going
up
again.I hope it works for some of you at least.
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 yourdocker-compose.yml
, try making them strings:EDIT:
I’m experiencing this very frequently on Mac, Docker 2.4.0.0, in two different projects with different docker-compose.yml configs. I don’t recall it ever happening before ~1 week ago which is when I upgraded to 2.4.0.0. Is there a regression?
I’ve tried increasing the timeout to 600, increasing RAM to 16GB & swap to 4GB, restarting Docker, restarting my entire Macbook, nothing seems to work, except randomly trying again and again then it will occasionally work. But then the next time I need to restart or rebuild a container, same problem 😦
Same issue here, also on mac and after the 2.4.0 update. I’m currently trying if downgrading helps.
Update: downgrading to the previous version, deleting cache and rebuilding fixes the issue.
3 years open this ticket and still unresolved. The problem still occurs even if we increase the client connection to 120 sec.
+1 on that, I am running stress testing on my instance which runs 4 containers and docker hangs even for
docker ps -a
so i’m trying to restart the containers but i am gettingUnixHTTPConnectionPool(host='localhost', port=None): Read timed out
andOnly if im restarting the
docker
service it seems to be resolved, any ideas?Ridiculous is right. Holy moly, I’ve been trying to fix this issue all afternoon. Thanks!
simple restart of docker solved this for me…
encountering this issue as well, still no solution???
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…
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)
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
I’m still experiencing frequently timeout errors since the 2.4.0 update that are still not fixed in 2.5.0
I resolved my issue with the following commands:
docker volume prune
docker system prune
(only one of these commands might be enough, but cannot reproduce for the moment…)We’re seeing this timeout when running a container via docker-compose or via the docker-py library (times out even after we bump the timeout to 2 minutes); however, we don’t see the error when we run via the Docker CLI (container starts instantly). We also only see the issue on a Linux CI server and not on our Macs. We’re working on building out a minimal reproducible example.
+1
`Restarting web-jenkins_jenkins_1 …
ERROR: for web-jenkins_jenkins_1 UnixHTTPConnectionPool(host=‘localhost’, port=None): Read timed out. (read timeout=130) 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: 120).`
i restart docker, it solved. but every day i need to restart
Having this issue “sometimes” on EC2 instance when trying to deploy with Gitlab Runner. Any help?
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.
@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.
@rvanbaalen @angelomelonas My colleagues and me have downgraded to
2.3.0.5
because of this.Yes I uninstalled the 2.4 and downloaded/reinstalled the 2.3. Now it works, I can start my containers as usual. I got the 2.3 from there: https://docs.docker.com/docker-for-mac/release-notes/#docker-desktop-community-2302
Also started having frequently this timeout error since the 2.4.0 update (on Mac OS Mojave 10.14.5)
Same here! With update to 2.4.0 our setups sometimes do not start at all with the mentioned
Read timed out.
errors, sometimes only some containers start up, others throw this error. I am already thinking about a downgrade!Just to mention: This issue affects both setups using NFS shares as well as projects using “normal” mounted volumes
I was having the same issue when I had the following in my docker-compose.yml:
The error was gone when I added quotes around “10”. This is stated in docs that the values for max-file and max-size must be string, but still. The error message is quite misleading.
For me, it helped to just restart docker.
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
FYI, downgrading to 2.2.0.5 worked for me.
@JoeCap08055 I reverted back to Docker Desktop 2.5.0.1 and I don’t have the issue.
I faced same issue, even I increased resource from 4GB RAM, 1GB swap to 6GB RAM, 2GB swap.
+1 restarting docker worked for me as well.
Thanks @gvilarino, I believe the big files mounting is the cause of this issue on my linux server. Your snippet could be a workaround if the big files are not needed in container.
However, I wonder why mounting is slow in Docker? Maybe it triggers disk copy? But why?
@patsevanton If you still have the issue with a recent version of Compose v2, open a new issue with a example to reproduce it
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.
Everyone could have different failure reason.
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 updatedDocker Desktop
to v4.1.1 and the error message went away.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 can confirm the same problem since I installed on Docker for Mac v2.4. I can also confirm a significant increase of RAM and CPU consumption even in idle moments, just with Docker daemon running. But I guess it has nothing to with compose package itself.
Same here. Significant slowdown in container creation, resulting in the aforementioned HTTP timeout error on Docker for Mac v2.4. Setting COMPOSE_HTTP_TIMEOUT=120 worked, but the container creation slowness is still a new issue. Downgrading to v2.3 also fixes this.
This has been happening pretty consistently for me since I started using Docker 2-3 years ago. After a container has been running for a while, it becomes a zombie and the entire Docker engine needs to be restarted for things to become responsive again. This feels like a resource leak of some kind, since idle time seems to be very relevant for the experienced behaviour.
If no containers are running, or they only run for a short amount of time, everything seems to be working fine for days or weeks. But as soon as I let a container run for a few hours, it becomes unresponsive, I have to force-stop it in the command line and any attempt at communicating with
docker
ordocker-compose
just fails with a timeout. A restart is the only working solution.Output of
docker-compose version
Output of
docker version
Output of
docker-compose config
macOS Mojave 10.14.6.
I started getting these since switching to Docker Edge with Caching on
We are having multiple issues with docker-compose, too.
After setting
MaxSessions 500
in sshd_config (see #6463) we now also get read time outs. Setting both timeouts to 120 seconds resolved the issue for the nextDOCKER_HOST=xxx@yyy docker-compose up -d
run.During the second run the machine load went as high as 30 (sic!) before the docker-compose command failed due to timeouts. A docker restart did does not solve this problem, not even temporarily. The Server is an AWS EC2 instance with enough CPU/Disk/NetIO etc, the compose file includes 1 traefik and 3 services with mailhog, so nothing special here. Running
docker-compose up -d
with the same docker-compose.yml file directly on the server works reliably and as expected. Running with --verbose shows over thousand consecutive lines containingcompose.parallel.feed_queue: Pending: set()
.I will try to rsync the docker-compose file to the remote server and run docker-compose directly on that machine as a workaround.
We had this issue and it appears (for us) to be related to a named volume with a lot of files. I don’t understand it, but it is the case for us that a docker-compose (edited for brevity) that has a service:
Inside the Dockerfile for serviceA is the seemingly harmless and ineffectual command:
Notice that this changes the owner recursively in /srvA/folder which in the named volume is a large filesystem with 100K’s of files. However, this happens when the image is built and that folder is empty. It appears using the named volume inherits the permissions of the image local file and then proceeds to change the named volumes permissions.
This is pretty edge and probably not the same problem everyone else is having but it was our problem (toggling the line toggles the error). The upshot is that this http timeout is probably resulting from multiple causes.
I found a neat solution to this (on MacOS)
The reason why this kept happening to me was that Docker had to little memory available.
Increasing the memory from 2GB up to 8GB solved the issue for me.
Just a FYI, with my case only retrying with docker-compose tends to resolve it. I don’t think I ever restarted dockerd, this issue doesn’t persist for me.
On Fri, Aug 2, 2019 at 1:39 PM Alex notifications@github.com wrote:
Same exact error here
Docker restarting also fixed it for me.
@titpetric can confirm I’m also having this issue.
@rodrigo-brito - I’ve been getting this error for a little while now and restarting docker deamon have been solving the issue - no more since I added another service to my project.
@cherrot I wouldn’t say I’m extremely proficient in the subject, but I believe this has to do with the storage driver used by Docker and how it works internally for keeping layers in order. Use
docker info
to see what storage driver your daemon is using (probablyaufs
, which is the slowest) and depending on your host OS, you may change it so something else (overlay
being a better choice, if supported). There are faster alternatives like LCFS but they aren’t commercially supported by Docker so you’d be on your own there.Does it happen if you turn off your WiFi? Could be related to https://github.com/docker/docker-py/issues/1076.
Another theory, if your service has
tty: True
enabled, could be #3106