You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
DockerException: Error while fetching server API version #2717
I noticed a change in the behavior of docker-py between version 4.2 and 4.3, caused by 727080b
Before this change, the client was created with an API version set to 1.35 by default. After this change, there's no more default, and the client retrieve this version from the docker daemon. So at this points the clients needs to talk to the docker daemon.
In practice, it means that prior to this change, a user that is NOT part of the docker group could still run docker.from_env() successfully. After this change it's not possible anymore. If user doesn't have the permission to talk to the daemon, docker.from_env() throw this exception:
Error: Error while fetching server API version: ('Connection aborted.', PermissionError(13, 'Permission denied'))
I wonder if it would be possible to get something a bit more precise than a DockerException in that case? I need to handle this case, and right now the only way is to look for `permission denied' in the error message, or something like that. It works, but matching bits of strings in an error message is usually not the right thing to do.
Thanks for these comments (and those in @tillahoffmann's linked issue), they helped my colleague get his local setup working. The trick was to enable this setting:
Thanks for these comments (and those in @tillahoffmann's linked issue), they helped my colleague get his local setup working. The trick was to enable this setting:
I had the same problem and had to activate the "Allow privileged port mapping" option in the advanced settings.
Activity
aiordache commentedon Dec 4, 2020
Can you provide the output from
docker versionplease?Try to run this to simulate what the server version retrieval method does:
To avoid this automatic version retrieval, please set the API version to use when you instantiate the docker client.
dazza-codes commentedon Dec 4, 2020
From
curl -s --unix-socket /var/run/docker.sock http://localhost/version | jq:{ "Platform": { "Name": "Docker Engine - Community" }, "Components": [ { "Name": "Engine", "Version": "19.03.14", "Details": { "ApiVersion": "1.40", "Arch": "amd64", "BuildTime": "2020-12-01T19:18:45.000000000+00:00", "Experimental": "false", "GitCommit": "5eb3275d40", "GoVersion": "go1.13.15", "KernelVersion": "4.15.0-126-generic", "MinAPIVersion": "1.12", "Os": "linux" } }, { "Name": "containerd", "Version": "1.3.9", "Details": { "GitCommit": "ea765aba0d05254012b0b9e595e995c09186427f" } }, { "Name": "runc", "Version": "1.0.0-rc10", "Details": { "GitCommit": "dc9208a3303feef5b3839f4323d9beb36df0a9dd" } }, { "Name": "docker-init", "Version": "0.18.0", "Details": { "GitCommit": "fec3683" } } ], "Version": "19.03.14", "ApiVersion": "1.40", "MinAPIVersion": "1.12", "GitCommit": "5eb3275d40", "GoVersion": "go1.13.15", "Os": "linux", "Arch": "amd64", "KernelVersion": "4.15.0-126-generic", "BuildTime": "2020-12-01T19:18:45.000000000+00:00" }null-sleep commentedon Jul 12, 2021
Having the same issue:
elboulangero commentedon Sep 23, 2021
I'm having the same issue.
I noticed a change in the behavior of docker-py between version 4.2 and 4.3, caused by 727080b
Before this change, the client was created with an API version set to 1.35 by default. After this change, there's no more default, and the client retrieve this version from the docker daemon. So at this points the clients needs to talk to the docker daemon.
In practice, it means that prior to this change, a user that is NOT part of the docker group could still run
docker.from_env()successfully. After this change it's not possible anymore. If user doesn't have the permission to talk to the daemon,docker.from_env()throw this exception:I wonder if it would be possible to get something a bit more precise than a DockerException in that case? I need to handle this case, and right now the only way is to look for `permission denied' in the error message, or something like that. It works, but matching bits of strings in an error message is usually not the right thing to do.
motin commentedon Nov 1, 2023
Thanks for these comments (and those in @tillahoffmann's linked issue), they helped my colleague get his local setup working. The trick was to enable this setting:

katewapo commentedon May 30, 2024
I have the same problem. Which App/GUI is it that the screenshot shows?
ThisDoctor commentedon Aug 21, 2024
I had the same problem and had to activate the "Allow privileged port mapping" option in the advanced settings.
jbonnier commentedon Apr 28, 2025
Not using Docker Desktop anyone has a fix so far?
ksyblast commentedon Apr 28, 2025
Hi! For me upgrading
requestslibrary was a fixjbonnier commentedon May 1, 2025
Oh wow! Updating the
requestslib on the target did it for me as well.Thanks mate