Question

docker-compose up -d reports error

Posted October 11, 2021 67 views
UbuntuDockerUbuntu 20.04

I use Ubuntu 20.04.3 LTS (GNU/Linux 5.11.0-37-generic x86_64)

I was following the instruction:
https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-compose-on-ubuntu-20-04#

After the command:
sudo docker-compose up -d

I got the error:

Traceback (most recent call last):
File “urllib3/connectionpool.py”, line 677, in urlopen
File “urllib3/connectionpool.py”, line 392, in makerequest
File “http/client.py”, line 1252, in request
File “http/client.py”, line 1298, in sendrequest
File “http/client.py”, line 1247, in endheaders
File “http/client.py”, line 1026, in sendoutput
File “http/client.py”, line 966, in send
File “docker/transport/unixconn.py”, line 43, in connect
FileNotFoundError: [Errno 2] No such file or directory

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 makerequest
File “http/client.py”, line 1252, in request
File “http/client.py”, line 1298, in sendrequest
File “http/client.py”, line 1247, in endheaders
File “http/client.py”, line 1026, in sendoutput
File “http/client.py”, line 966, in send
File “docker/transport/unixconn.py”, line 43, in connect
urllib3.exceptions.ProtocolError: (‘Connection aborted.’, FileNotFoundError(2, 'No such file or directory’))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “docker/api/client.py”, line 205, in retrieveserver_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.’, FileNotFoundError(2, 'No such file or directory’))

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 performcommand
File “compose/cli/command.py”, line 69, in project
fromoptions
File “compose/cli/command.py”, line 132, in get
project
File “compose/cli/dockerclient.py”, line 43, in getclient
File “compose/cli/dockerclient.py”, line 170, in dockerclient
File “docker/api/client.py”, line 188, in init
File “docker/api/client.py”, line 213, in retrieveserver_version
docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.’, FileNotFoundError(2, 'No such file or directory’))
[228567] Failed to execute script docker-compose

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Hi there,

Is the Docker service up and running? You can check this with the following command:

sudo systemctl status docker

If this is not the case you can start it with:

sudo systemctl start docker

If this is still happening, then you might be running the docker-compose command with a low privileged user. If this is the case, run the following command:

sudo usermod -aG docker ${USER}

Then in order to apply this new user group membership, you will need to either log out of the server and back in, or run this command:

su - ${USER}

Let me know how it goes.
Best,
Bobby