Unable to docker-compose up any project
Asked Answered
C

7

33

Whenever I try to docker-compose up any project I get the following error. I've tried with and without sudo I am only having this issue on this machine. I am able to run the same containers on my Mac and Amazon WorkSpace.

(myslabs) [austin@localhost myslabs]$ sudo docker-compose up
[sudo] password for austin: 
Traceback (most recent call last):
  File "urllib3/connectionpool.py", line 677, in urlopen
  File "urllib3/connectionpool.py", line 392, in _make_request
  File "http/client.py", line 1252, in request
  File "http/client.py", line 1298, in _send_request
  File "http/client.py", line 1247, in endheaders
  File "http/client.py", line 1026, in _send_output
  File "http/client.py", line 966, in send
  File "docker/transport/unixconn.py", line 43, in connect
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "requests/adapters.py", line 449, in send
  File "urllib3/connectionpool.py", line 727, in urlopen
  File "urllib3/util/retry.py", line 403, in increment
  File "urllib3/packages/six.py", line 734, in reraise
  File "urllib3/connectionpool.py", line 677, in urlopen
  File "urllib3/connectionpool.py", line 392, in _make_request
  File "http/client.py", line 1252, in request
  File "http/client.py", line 1298, in _send_request
  File "http/client.py", line 1247, in endheaders
  File "http/client.py", line 1026, in _send_output
  File "http/client.py", line 966, in send
  File "docker/transport/unixconn.py", line 43, in connect
urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionRefusedError(111, 'Connection refused'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "docker/api/client.py", line 205, in _retrieve_server_version
  File "docker/api/daemon.py", line 181, in version
  File "docker/utils/decorators.py", line 46, in inner
  File "docker/api/client.py", line 228, in _get
  File "requests/sessions.py", line 543, in get
  File "requests/sessions.py", line 530, in request
  File "requests/sessions.py", line 643, in send
  File "requests/adapters.py", line 498, in send
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionRefusedError(111, 'Connection refused'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "bin/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 "docker/api/client.py", line 188, in __init__
  File "docker/api/client.py", line 213, in _retrieve_server_version
docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', ConnectionRefusedError(111, 'Connection refused'))
[142201] Failed to execute script docker-compose

I've not been able to find any articles about any similar issues. I am using Centos 8 running inside of a VirtualBox on Windows.

(myslabs) [austin@localhost myslabs]$ docker --version
Docker version 19.03.13, build 4484c46d9d
(myslabs) [austin@localhost myslabs]$ docker-compose --version
docker-compose version 1.27.3, build 4092ae5d

Any help would greatly be appreciated.

Cork answered 1/10, 2020 at 21:31 Comment(2)
Trying to connect to a remote docker daemon exposed over TCP? Is the docker daemon running? Can i.e. docker ps?Crescint
So I checked and docker was not running... a rookie mistake. The issue was with the docker daemon config. However now not able to resolve 'deb.debian.org' when building an image. My config looks like this: { "dns":["8.8.4.4", "8.8.8.8"] } Cork
L
44

I also encountered the same error as you,My problem is that docker does not start.

  • check docker status systemctl status docker

  • systemctl start docker

  • docker-compose up try again

  • systemctl enable docker to start on boot

Lightly answered 9/10, 2020 at 10:4 Comment(4)
Is there a way to auto check and re issue systemctl start docker ?Unicorn
also do systemctl enable docker to start on bootKilby
Also, if your system isn't using systemd, you could instead try the service wrapper: service docker start.Recede
@Unicorn I recommend you use supervisord.orgLightly
D
15

If you're on a Mac, it may mean that Docker itself isn't running. I had rebooted my Mac and Docker wasn't set to automatically launch at login. You can set this as a Docker preference.

Dotti answered 15/12, 2020 at 19:11 Comment(1)
I had to start Docker DesktopInterpellation
R
5

If On WSL2 ensure that the docker service has been started, use sudo service docker status to check. If it is not running, use the command sudo service docker start to get it running before sudo docker-compose up

Recalescence answered 30/7, 2021 at 6:33 Comment(1)
Interesting. Mine doesn't come up with "start". No error, though.Inn
R
4

If nothing works, run:

sudo chmod +x /usr/local/bin/docker-compose

sudo docker-compose up -d
Ruthy answered 6/4, 2021 at 13:29 Comment(1)
This line solved my problem with grpc-web sampleBignoniaceous
O
2

Sometimes docker service is stopped. You can check it and restart.Normally happens if error iscontainer. can pruine and start again.

Orlina answered 23/5, 2021 at 10:8 Comment(1)
Please provide the necessary commands to do this. See here for more information on how to write a good answer: stackoverflow.com/help/how-to-answer Please elaborate what you mean by "Normally happens if error iscontainer". If you have problems with the English language deepl.com might help :)Lingam
E
1

This issue comes mainly in the case of windows. restart your docker container.

enter image description here

then run the docker command from your terminal

Evie answered 10/7, 2022 at 19:22 Comment(0)
A
0

Please restart docker containers and it will work fine.

Alwyn answered 3/4, 2022 at 11:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.