Tips To Solve “docker.errors.DockerException: Error while fetching server API version”

Docker compose is a tool known for executing multi-container applications on docker with the help of the compose file format. You can easily use multiple containers at a time, which makes docker a choice for programmers. It allows you to create a YAML file for defining services with a single command. Docker compose permits developers or programmers to simply host many isolated environments on a single host. When working with docker-compose, you may experience the error “docker.errors.DockerException: Error while fetching server API version”.

We at Tutopal are going to help all of you looking to solve this error. Go through the post to know the tips to get rid of the error warning. Let’s figure out how the error shows up

How the error pops up

When you try to execute docker-compose built, you get the error message. This is how the error message appears

File "/home/ming/.local/lib/python3.8/site-packages/docker/api/", 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'))

Ways To Solve the Error “docker.errors.DockerException: Error while fetching server API version”

We have solids options that can help you get rid of the error warning you are facing. Take a look at the options

Option 1 – Make docker run

The first solution you need to try is to make docker run. If it is not working or unable to connect compose to the docker via socket, you get the error warning. In order to check the status of the docker, you can use the ‘systemctl status docker’ command. To make docker run, use the following commands

sudo service docker restart


sudo service docker start


systemctl start docker

It resolves the error message.

Option 2 – Set permission 666

Another way to tackle the error is to set permission to 666 for your docker. It is the easiest way to make the error go away. You just need to use the following command

sudo chmod 666 /var/run/docker.sock

Option 3 – Turn on WSL integration

In order to activate WSL, you just need to follow the below procedure step by step

  • Click to open the Docker desktop
  • Tap on settings and choose Resources
  • Now, you just need to click on the WSL integration
  • Ensure you have enabled your distribution
  • In the end, just restart the docker
  • It is an option that you must try to resolve the error message.

Option 4 – Confirm the docker version

If you are using Linux, you need to confirm if the docker daemon is executing. To do that, you need to use the following command

systemctl status docker

To start, the below command is really helpful

systemctl start docker

It simply informs you the docker version you are currently using on which operating system.


We highlighted the options to help you solve the error “docker.errors.DockerException: Error while fetching server API version”. You can choose any options that are suitable for your project’s condition/status. I hope you enjoyed it and find it useful! I wish you happy coding!

Leave a Reply

Your email address will not be published. Required fields are marked *