2

I'm using Docker Compose to set up Apache Airflow and right when I use

docker-compose up airflow-init

I get this error:

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
  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 _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.', 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 _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.', 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 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.', FileNotFoundError(2, 'No such file or directory'))
[81] Failed to execute script docker-compose

This is the yaml file I'm using: https://airflow.apache.org/docs/apache-airflow/stable/docker-compose.yaml

And this was the tutorial I was following: https://www.youtube.com/watch?v=aTaytcxy2Ck&t=398s

3
  • 1
    You don't have docker installed or its not running. Commented Aug 15, 2021 at 17:57
  • I'll do a more thorough Docker installation. Thanks Commented Aug 15, 2021 at 18:07
  • I can't get the Docker daemon to start running. I do command "sudo service docker start" and it says OK but then when I run "sudo docker run hello-world", which is an installation check step, it comes back with an error. I'll probably need to open a new question, but any help is appreciated. Commented Aug 15, 2021 at 18:47

1 Answer 1

2

Maybe you have docker installed but it is not running or your user is not configured to access it.

This is the same error as described here:

https://github.com/docker/compose/issues/7896

You can double-check it by running docker ps. If it shows no processes (but it does not errors out) then your docker is running and is properly configured.

Another thing to check if is your user is properly configured to access docker. On Linux you should make sure your user is added to docker group. See https://docs.docker.com/engine/install/linux-postinstall/

Sign up to request clarification or add additional context in comments.

2 Comments

Needed "sudo chmod 666 /var/run/docker.sock". Thanks!
Will work but it is not very secure :). I think adding your user to docker group is "safer". And one of the steps in the tutorial is to set the user in docker container to be the same as your "host" user - which will make it have access to the socket as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.