Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 873
blackSwan566 Avatar asked Nov 03 '20 11:11

blackSwan566


People also ask

What is rest API in docker?

The Docker Engine API is a RESTful API accessed by an HTTP client such as wget or curl , or the HTTP library which is part of most modern programming languages.

What is a docker compose?

Docker Compose is a tool that was developed to help define and share multi-container applications. With Compose, we can create a YAML file to define the services and with a single command, can spin everything up or tear it all down.

How docker API works?

Docker uses a client-server architecture. The Docker client talks to the Docker daemon, which does the heavy lifting of building, running, and distributing your Docker containers. The Docker client and daemon can run on the same system, or you can connect a Docker client to a remote Docker daemon.


2 Answers

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 
like image 170
Zstack Avatar answered Oct 01 '22 09:10

Zstack


just open Docker Desktop on your computer

like image 44
slideWXY Avatar answered Oct 01 '22 10:10

slideWXY