close

[Solved] docker.errors.DockerException: Error while fetching server API version

Hello Guys, How are you all? Hope You all Are Fine. Today When I am trying to run docker-compose build I am facing following error docker.errors.DockerException: Error while fetching server API version in docker. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How docker.errors.DockerException: Error while fetching server API version Error Occurs ?

When I am trying to run docker-compose build I am facing following error.

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 docker.errors.DockerException: Error while fetching server API version Error ?

  1. How To Solve docker.errors.DockerException: Error while fetching server API version Error ?

    To Solve docker.errors.DockerException: Error while fetching server API version Error This Problem Usually occurs whenever docker is not running OR compose is not able to connect to docker via docker socket. Also You can check docker status with this command systemctl status docker. So that Just restart Or Start docker with this command. sudo service docker start

  2. docker.errors.DockerException: Error while fetching server API version

    To Solve docker.errors.DockerException: Error while fetching server API version Error This Problem Usually occurs whenever docker is not running OR compose is not able to connect to docker via docker socket. Also You can check docker status with this command systemctl status docker. So that Just restart Or Start docker with this command. sudo service docker start

Solution 1: Make Sure Docker running

This Problem Usually occurs whenever docker is not running OR compose is not able to connect to docker via docker socket. Also You can check docker status with this command systemctl status docker. So that Just restart Or Start docker with this command.

sudo service docker start

OR

sudo service docker restart

OR

systemctl start docker

Solution 2: Set Permission

Just Set permission 666 for docker Just using below command.

sudo chmod 666 /var/run/docker.sock

Solution 3: enable WSL Integration

Just enable WSL Integration. Follow these step.

  1. First of all Open Docker Desktop
  2. Then Go to Settings
  3. Then Select Resources
  4. And Click on WSL Integration
  5. Make sure that your distribution is enabled
  6. Restart Docker

Summary

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also, Read

Leave a Comment