If you have Docker up and running and get the following error, please read on:

ERROR    Could not connect to docker. Please confirm docker is installed and running
ERROR    Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))

Quick fix

Create the /var/run/docker.sock symlink using:

sudo ln -s "$HOME/.docker/run/docker.sock" /var/run/docker.sock

In 99% of the cases, this should work. If it doesnt, try:

sudo chown $USER /var/run/docker.sock

Full details

Phidata uses docker-py to run containers, and if the /var/run/docker.sock is missing or has incorrect permissions, it cannot connect to docker.

To fix, please create the /var/run/docker.sock file using:

sudo ln -s "$HOME/.docker/run/docker.sock" /var/run/docker.sock

If that does not work, check the permissions using ls -l /var/run/docker.sock.

If the /var/run/docker.sock does not exist, check if the $HOME/.docker/run/docker.sock file is missing. If its missing, please reinstall Docker.

If none of this works and the /var/run/docker.sock exists:

  • Give your user permissions to the /var/run/docker.sock file:
sudo chown $USER /var/run/docker.sock
  • Give your user permissions to the docker group:
sudo usermod -a -G docker $USER

More info

Was this page helpful?