compose: Errors running up

Hello, when I run docker compose up I get the following errors :

$ docker-compose up -d
Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/urllib3/connectionpool.py", line 670, in urlopen
    httplib_response = self._make_request(
  File "/usr/lib/python3.8/site-packages/urllib3/connectionpool.py", line 392, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/lib/python3.8/http/client.py", line 1255, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.8/http/client.py", line 1301, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.8/http/client.py", line 1250, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.8/http/client.py", line 1010, in _send_output
    self.send(msg)
  File "/usr/lib/python3.8/http/client.py", line 950, in send
    self.connect()
  File "/usr/lib/python3.8/site-packages/docker/transport/unixconn.py", line 43, in connect
    sock.connect(self.unix_socket)
FileNotFoundError: [Errno 2] No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
  File "/usr/lib/python3.8/site-packages/urllib3/connectionpool.py", line 726, in urlopen
    retries = retries.increment(
  File "/usr/lib/python3.8/site-packages/urllib3/util/retry.py", line 403, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/usr/lib/python3.8/site-packages/urllib3/packages/six.py", line 734, in reraise
    raise value.with_traceback(tb)
  File "/usr/lib/python3.8/site-packages/urllib3/connectionpool.py", line 670, in urlopen
    httplib_response = self._make_request(
  File "/usr/lib/python3.8/site-packages/urllib3/connectionpool.py", line 392, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/lib/python3.8/http/client.py", line 1255, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.8/http/client.py", line 1301, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.8/http/client.py", line 1250, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.8/http/client.py", line 1010, in _send_output
    self.send(msg)
  File "/usr/lib/python3.8/http/client.py", line 950, in send
    self.connect()
  File "/usr/lib/python3.8/site-packages/docker/transport/unixconn.py", line 43, in connect
    sock.connect(self.unix_socket)
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 "/usr/lib/python3.8/site-packages/docker/api/client.py", line 205, in _retrieve_server_version
    return self.version(api_version=False)["ApiVersion"]
  File "/usr/lib/python3.8/site-packages/docker/api/daemon.py", line 181, in version
    return self._result(self._get(url), json=True)
  File "/usr/lib/python3.8/site-packages/docker/utils/decorators.py", line 46, in inner
    return f(self, *args, **kwargs)
  File "/usr/lib/python3.8/site-packages/docker/api/client.py", line 228, in _get
    return self.get(url, **self._set_request_timeout(kwargs))
  File "/usr/lib/python3.8/site-packages/requests/sessions.py", line 543, in get
    return self.request('GET', url, **kwargs)
  File "/usr/lib/python3.8/site-packages/requests/sessions.py", line 530, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python3.8/site-packages/requests/sessions.py", line 643, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python3.8/site-packages/requests/adapters.py", line 498, in send
    raise ConnectionError(err, request=request)
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 "/usr/bin/docker-compose", line 33, in <module>
    sys.exit(load_entry_point('docker-compose==1.27.4', 'console_scripts', 'docker-compose')())
  File "/usr/lib/python3.8/site-packages/compose/cli/main.py", line 67, in main
    command()
  File "/usr/lib/python3.8/site-packages/compose/cli/main.py", line 123, in perform_command
    project = project_from_options('.', options)
  File "/usr/lib/python3.8/site-packages/compose/cli/command.py", line 60, in project_from_options
    return get_project(
  File "/usr/lib/python3.8/site-packages/compose/cli/command.py", line 131, in get_project
    client = get_client(
  File "/usr/lib/python3.8/site-packages/compose/cli/docker_client.py", line 41, in get_client
    client = docker_client(
  File "/usr/lib/python3.8/site-packages/compose/cli/docker_client.py", line 170, in docker_client
    client = APIClient(**kwargs)
  File "/usr/lib/python3.8/site-packages/docker/api/client.py", line 188, in __init__
    self._version = self._retrieve_server_version()
  File "/usr/lib/python3.8/site-packages/docker/api/client.py", line 212, in _retrieve_server_version
    raise DockerException(
docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))

It seems that some files ares missing? But I don’t know which one.

OS : Linux Manjaro

$ docker -v
Docker version 19.03.12-ce, build 48a66213fe
$ docker-compose version
docker-compose version 1.27.4, build unknown
docker-py version: 4.3.1
CPython version: 3.8.5
OpenSSL version: OpenSSL 1.1.1h  22 Sep 2020

I tried by installing compose via pacman, pip, or by taking directly the binary via curl. It seems that all the needed dependencies are installed, exemple by installing with pip:

$ pip install docker-compose
Defaulting to user installation because normal site-packages is not writeable
Collecting docker-compose
  Downloading docker_compose-1.27.4-py2.py3-none-any.whl (110 kB)
     |████████████████████████████████| 110 kB 2.8 MB/s
Requirement already satisfied: cached-property<2,>=1.2.0 in /usr/lib/python3.8/site-packages (from docker-compose) (1.5.2)
Requirement already satisfied: PyYAML<6,>=3.10 in /usr/lib/python3.8/site-packages (from docker-compose) (5.3.1)
Requirement already satisfied: docopt<1,>=0.6.1 in /usr/lib/python3.8/site-packages (from docker-compose) (0.6.2)
Requirement already satisfied: requests<3,>=2.20.0 in /usr/lib/python3.8/site-packages (from docker-compose) (2.24.0)
Requirement already satisfied: docker[ssh]<5,>=4.3.1 in /usr/lib/python3.8/site-packages (from docker-compose) (4.3.1)
Requirement already satisfied: python-dotenv<1,>=0.13.0 in /usr/lib/python3.8/site-packages (from docker-compose) (0.14.0)
Requirement already satisfied: dockerpty<1,>=0.4.1 in /usr/lib/python3.8/site-packages (from docker-compose) (0.4.1)
Requirement already satisfied: jsonschema<4,>=2.5.1 in /usr/lib/python3.8/site-packages (from docker-compose) (3.2.0)
Requirement already satisfied: texttable<2,>=0.9.0 in /usr/lib/python3.8/site-packages (from docker-compose) (1.6.3)
Requirement already satisfied: distro<2,>=1.5.0 in /usr/lib/python3.8/site-packages (from docker-compose) (1.5.0)
Requirement already satisfied: websocket-client<1,>=0.32.0 in /usr/lib/python3.8/site-packages (from docker-compose) (0.57.0)
Requirement already satisfied: chardet>=3.0.2 in /usr/lib/python3.8/site-packages (from requests<3,>=2.20.0->docker-compose) (3.0.4)
Requirement already satisfied: idna>=2.5 in /usr/lib/python3.8/site-packages (from requests<3,>=2.20.0->docker-compose) (2.10)
Requirement already satisfied: urllib3>=1.21.1 in /usr/lib/python3.8/site-packages (from requests<3,>=2.20.0->docker-compose) (1.25.10)
Requirement already satisfied: six>=1.4.0 in /usr/lib/python3.8/site-packages (from docker[ssh]<5,>=4.3.1->docker-compose) (1.15.0)
Requirement already satisfied: paramiko>=2.4.2 in /usr/lib/python3.8/site-packages (from docker[ssh]<5,>=4.3.1->docker-compose) (2.7.2)
Requirement already satisfied: attrs>=17.4.0 in /usr/lib/python3.8/site-packages (from jsonschema<4,>=2.5.1->docker-compose) (20.2.0)
Requirement already satisfied: pyrsistent>=0.14.0 in /usr/lib/python3.8/site-packages (from jsonschema<4,>=2.5.1->docker-compose) (0.17.3)
Requirement already satisfied: setuptools in /usr/lib/python3.8/site-packages (from jsonschema<4,>=2.5.1->docker-compose) (50.3.0)
Requirement already satisfied: bcrypt>=3.1.3 in /usr/lib/python3.8/site-packages (from paramiko>=2.4.2->docker[ssh]<5,>=4.3.1->docker-compose) (3.2.0)
Requirement already satisfied: cryptography>=2.5 in /usr/lib/python3.8/site-packages (from paramiko>=2.4.2->docker[ssh]<5,>=4.3.1->docker-compose) (3.1.1)
Requirement already satisfied: pynacl>=1.0.1 in /usr/lib/python3.8/site-packages (from paramiko>=2.4.2->docker[ssh]<5,>=4.3.1->docker-compose) (1.4.0)
Requirement already satisfied: cffi>=1.1 in /usr/lib/python3.8/site-packages (from bcrypt>=3.1.3->paramiko>=2.4.2->docker[ssh]<5,>=4.3.1->docker-compose) (1.14.3)
Requirement already satisfied: pycparser in /usr/lib/python3.8/site-packages (from cffi>=1.1->bcrypt>=3.1.3->paramiko>=2.4.2->docker[ssh]<5,>=4.3.1->docker-compose) (2.20)
Installing collected packages: docker-compose
Successfully installed docker-compose-1.27.4

Thanks for your help.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 27
  • Comments: 35

Most upvoted comments

I have run into this exact issue. I solved this by making sure that I run sudo systemctl start docker and then running sudo docker-compose up

Jup this happens if docker is not running (which is the default for arch/manjaro). Instead of some meaningless backtrace it should print some proper error message in this case. As far as I remember, earlier versions of compose did that.

I second this suggestion of proper error message like “Error: Docker process not running”

if on a mac, just make sure docker is started.

cmd + space + type "docker" into the search bar + enter

You shouldn’t close this issue then. This needs proper error message.

I also wasted time trying to interpret this error message. I had gotten so used to docker always running at startup that I had forgotten I disabled it since even though I wasn’t using it it was eating up cpu at times.

Thanks to this page, googling the error message saved me some time.

I have run into this exact issue. I solved this by making sure that I run sudo systemctl start docker and then running sudo docker-compose up

Oh, thanks a lot. It was indeed simply Docker which was not running. I was so sure I already started Docker that I didn’t thought about it.

Jup this happens if docker is not running (which is the default for arch/manjaro). Instead of some meaningless backtrace it should print some proper error message in this case. As far as I remember, earlier versions of compose did that.

Yeah I agree too.

sudo systemctl start docker

sudo launchctl start docker for mac

Thanks for this post. Was helpful along with [REF] https://askubuntu.com/questions/1379425/system-has-not-been-booted-with-systemd-as-init-system-pid-1-cant-operate … to understand what was going on and get to sudo service docker start working to start docker service on ubuntu 20.04 on WSL2 to allow docker compose to work.

Future of Docker Compose is taking place on the Go implementation to be bundled with the Docker CLI as a plugin, see https://github.com/docker/compose-cli

Compose v1 entered the End of Life process, you should switch to compose v2

I second this suggestion of proper error message like “Error: Docker process not running”

that’s right

If you have the same trouble in Kali:

  1. remove compose
  2. install compose — curl -s https://api.github.com/repos/docker/compose/releases/latest | grep browser_download_url | grep docker-compose-linux-x86_64 | cut -d ‘"’ -f 4 | wget -qi - chmod +x docker-compose-linux-x86_64 sudo mv docker-compose-linux-x86_64 /usr/local/bin/docker-compose check: docker-compose version

this help me

The interviewer asked me to submit the project with the instructions to run the project locally. I used docker to remove the hassle. Now it has become a hassle 😠

if on a mac, just make sure docker is started.

cmd + space + type "docker" into the search bar + enter

i forgot im running on mac haha thanks for reply

You can run this command on macOS to start Docker: open --hide --background -a Docker 🎉

@renatoaraujoc That would be awesome!

I have run into this exact issue. I solved this by making sure that I run sudo systemctl start docker and then running sudo docker-compose up

And in Mac, I solved by install Docker.app follow this

Was very confused getting this error. Just a simple “Are you sure docker is running?” would solve this.

Receiving the same error message today on docker-compose version 1.27.4, build 40524192 debian 9 x64

Edit: I found it. Turns out that it was actually that I had docker compose installed but not docker itself.