dockermacospycharmdocker-daemon

PyCharm Cannot Connect to Docker, thinks the Docker daemon is not running


The PyCharm interface to Docker has suddenly stopped working on my Mac. When I try to connect to Docker I get the error message "Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?".

Docker appears to be working correctly. docker info returns reasonable results. The Docker Desktop is running. I can start a container through Docker Desktop and connect to it. Kibana works. The only thing that looks odd is that /var/run/docker.sock does not exist.

Is it a problem that docker.sock does not exist?

The PyCharm configuration for Docker looks like this:

enter image description here

I haven't changed it since everything worked.

A common solution suggested online it to change the permissions on the /var/run/docker.sock file, but obviously I can't do that. There is an assortment of things to try, but most of them require sudo and I don't have admin privileges on this machine. There is a Stack Overflow question that describes the same situation, but there the problem was that Docker could not be run without sudo, which is not the case here.

What is particularly strange is that this was working just a few days ago, and as far as I know nothing on the machine has changed. Same PyCharm setup, same Docker, same OS. I'm on

I have tried restarting the system.

Any ideas on what is broken?


Solution

  • The problem was that /var/run/docker.sock did not exist.

    More details are in this Docker support forum thread.

    This fix was to create the following softlink:

    ln -s ~/.docker/run/docker.sock /var/run/docker.sock