Docker-compose up : Error while fetching server API version: ('Connection aborted.', ConnectionRefusedError(61, 'Connection refused'))

51,119

Solution 1

Add your user to docker group and try again.

sudo gpasswd -a $USER docker
newgrp docker

If you still have the problem, you may try after logging out and login back, or reboot. Or simply do:

sudo su $USER

Note: this may also happens if docker is not running on your machine. For linux with sytemd service manager, you could verify using command:

systemctl status docker.service

Solution 2

just open Docker Desktop on your computer

Solution 3

Make sure your docker is actually running on your machine. You can use this post: How to check if the docker engine and a docker container are running?

Solution 4

I had the same issue and error message. In my case i had to start and enable docker service.

systemctl start docker
systemctl enable docker

Solution 5

Solution: This means you haven’t started your docker service!

First, try to start it using

1.sudo systemctl start docker

2.sudo service docker start

3.sudo /etc/init.d/docker restart

For More Info see this docs:here

Share:
51,119
blackSwan566
Author by

blackSwan566

Updated on July 08, 2022

Comments

  • blackSwan566
    blackSwan566 almost 2 years

    I am trying to do the docker-compose up command in my terminal. First I navigate to the file directory where I find a docker-compose.yaml. Then I write the command. The Server is on Port 80. I get the following error:

    Traceback (most recent call last):
          File "site-packages/docker/api/client.py", line 205, in _retrieve_server_version
          File "site-packages/docker/api/daemon.py", line 181, in version
          File "site-packages/docker/utils/decorators.py", line 46, in inner
          File "site-packages/docker/api/client.py", line 228, in _get
          File "site-packages/requests/sessions.py", line 543, in get
          File "site-packages/requests/sessions.py", line 530, in request
          File "site-packages/requests/sessions.py", line 643, in send
          File "site-packages/requests/adapters.py", line 498, in send
        requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionRefusedError(61, 'Connection refused'))
        
        During handling of the above exception, another exception occurred:
        
        Traceback (most recent call last):
          File "docker-compose", line 3, in <module>
          File "compose/cli/main.py", line 67, in main
          File "compose/cli/main.py", line 123, in perform_command
          File "compose/cli/command.py", line 69, in project_from_options
          File "compose/cli/command.py", line 132, in get_project
          File "compose/cli/docker_client.py", line 43, in get_client
          File "compose/cli/docker_client.py", line 170, in docker_client
          File "site-packages/docker/api/client.py", line 188, in __init__
          File "site-packages/docker/api/client.py", line 213, in _retrieve_server_version
        docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', ConnectionRefusedError(61, 'Connection refused'))
        [12728] Failed to execute script docker-compose
    

    The first error shows up two times then the second.