-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
urllib3.exceptions.ReadTimeoutError: UnixHTTPConnectionPool(host='localhost', port=None): Read timed out. (read timeout=60) #2266
Comments
+1 ... seeing this on Azure VMs running Ubuntu 16.04 semi-regularly which are basically just using docker-py to pull and run with some mounted volumes, and not sure how to deal with it. |
Are your containers reading/writing lots of data to disk? |
I've worked around this by realizing it always happened after right after reboot, despite systemctl saying that docker was active. The workaround was literally to do "docker run hello-world" in a loop until it succeeded before starting the scripts which use docker-py :) |
I am seeing this behaviour on an AWS EC2 c5.4xlarge instance, that is doing nothing but run containers. I don't think it is docker isn't running yet as I am getting this problem from code running within a container that is attempting to start up another container. Seems to work without issue on my local machines Ubuntu 18.04 VM, but on the EC2 instance, it all works for a period and then I get this error. The Container being started up is a PostgreSQL container, and it is being initialised with SQL data sets of a few 100MB from SQL dump. I get the error from a Docker-Py call to run on a container in detached mode. |
I'm seeing very similar behavior to @Hisol; on an Amazon i3.8xlarge on Ubuntu with The actual container creation seems to take a bit over 2 minutes. The Python code actually waits around for the full 2 minutes and change, and only then raises the error that the timeout was exceeded, after the daemon finally sends a reply. The container does end up getting created, but it stays in "created" state and is never put into "running" state because my Python code has been stopped by the timeout. I think it might have to do with the amount of data being mounted into the container (probably a few GB at least). When I capture the bytes that the module is sending over the Docker socket for the request, and replay them later after clearing out all existing containers and after the actual data that was supposed to be getting mounted in has been deleted, I can get the container to be created promptly. Here's what socat has to say about what is going through the Docker socket when I interpose it:
Note that it takes 2 minutes for the reply to come back from the daemon. I don't see the timeout exception on the client side until after the reply is printed by socat. Given that the timeout doesn't actually seem to be any protection against a hung server, and given that operations like pulling an image or even starting a container from an image that has already been pulled can consistently, in some configurations, take more than 60 seconds, the default timeout should be raised. In fact, I think the default behavior should be to wait indefinitely as long as the connection to the daemon has not dropped, unless the user actually asks for a timeout. |
`wait` will raise `ConnectionError` instead of `ReadTimeout` if the request is timeout, this is inconsistent with documentation. related: docker/docker-py#2266
I've 12 services in my
docker-compose.yml
which I'm running at the same time, however sometimes they're failing with timeout when runningdocker-compose up
.Logs:
Here is another one:
I've a good machine, so I don't think that's the issue. Everything is on local.
Related:
The text was updated successfully, but these errors were encountered: