. Advertisement .
..3..
. Advertisement .
..4..
The error: “docker.errors.DockerException: Error while fetching server API version” is a common error that can show up in many ways. In this blog, we will go through some of the ways you can fix this issue. Read on.
What is The Error: “docker.errors.DockerException: Error while fetching server API version”?
You might get the following problem while trying to execute docker-compose build. If docker is not operating or compose is unable to connect to docker through docker socket, this issue arises. Even, you try to update the Docker version and restart Docker many times. But it didn’t work
File "/home/ming/.local/lib/python3.8/site-packages/docker/api/client.py", line 212, in _retrieve_server_version
raise DockerException(
docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))
How To Solve The Error: “docker.errors.DockerException: Error while fetching server API version”?
Approach 1: Ensure Docker Run
If docker is not operating or compose is unable to connect to docker through docker socket, this issue arises. You can also use the command systemctl status docker to check the status of your Docker containers. So, simply use the following command to restart or start Docker:
sudo service docker start
or
sudo service docker restart
or
systemctl start docker
Approach 2: Set Permission
Just give docker permission 666. Simply run the following command.
sudo chmod 666 /var/run/docker.sock
Approach 3: Enable WSL Integration
Simply turn on WSL Integration. Follow the steps below.
- To begin with, access Docker Desktop. Next, go to Settings, then Resources, and finally WSL Integration.
- Ensure your distribution is turned on.
- Start Docker again.
Approach 4: Check Docker version
In case of running on linux -> run systemctl status docker
to check if docker daemon is running and systemctl start docker
to start it.
This help to tell what OS and docker version
are you using
Conclusion
We hope you enjoyed our article about the error. With this knowledge, we know that you can fix your error: “docker.errors.DockerException: Error while fetching server API version” quickly by following these steps! If you still have any other questions about fixing this syntax error, please leave a comment below. Thank you for reading!
Leave a comment