. Advertisement .
..3..
. Advertisement .
..4..
Docker is a powerful tool to deploy applications by keeping the environment consistent. However, sometimes you may face the error of ‘docker.errors.DockerException: Error while fetching server API version: (‘Connection aborted.’, ConnectionRefusedError(61, ‘Connection refused’))’. In this blog, you will find out some solutions to this annoying error.
What is “docker.errors.DockerException: Error while fetching server API version: (‘Connection aborted.’, ConnectionRefusedError(61, ‘Connection refused’))”?
When trying to run the docker-compose up command, you might get the following error.
docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', ConnectionRefusedError(61, 'Connection refused'))
[12728] Failed to execute script docker-compose
How to fix it?
A fairly common cause of the above error is that you forgot to add the current user to the docker group. To handle the above error is also very simple. Here are some solutions for you:
Approach 1: Include the user in the Docker group
Firstly, use this command to include your user in the Docker group:
sudo gpasswd -a $USER docker
newgrp docker
If your problem hasn’t been resolved, run this command: sudo su $USER
Approach 2: Access Docker Desktop
If you’re using a Mac, simply launch Docker Desktop.
Approach 3: Enable and begin the Docker service
Utilize this command to enable and begin the Docker service:
systemctl start docker
systemctl enable docker
Approach 4
In case you have not added the current user to docker group, follow these steps, the above error will be handled:
First of all, if there is no Docker group yet, create it by:
sudo groupadd docker
then, add user to group
sudo usermod -aG docker $USER
Finally, log out and back in to test. Use this command to check:
docker ps
Conclusion
We hope you enjoyed our blog post on how to repair the error “docker.errors.DockerException: Error while fetching server API version: (‘Connection aborted.’, ConnectionRefusedError(61, ‘Connection refused’))”. Please leave a comment if you have any further questions or concerns regarding this problem. Thank you for taking the time to read; we are always delighted anytime one of our pieces can give important information on this topic!
Leave a comment