Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

Hello

So recently I switched to a new PopOS 20.04 laptop.  I migrated all my Setting to PhpStorm 2020.3.  I have docker setup and it is running fine:

john@tandem:~$ groups
john adm sudo docker

john@tandem:~$ docker run hello-world

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/

For more examples and ideas, visit:
https://docs.docker.com/get-started/

 

So for some reason my PhpStorm will not connect to the docker daemon even though my local docker setup is working and the hello world example works just fine.  I see the following:

 

I have tried just about every suggestion out there to no avail.  It is not detecting docker or any of the containers.  Here is the weird part.  On a project in which I moved the .idea folder from my old laptop, it still shows the message but it also has the docker image and I can run my XDebug on this project only:

 

Very odd and I can't figure out what is happening.  Any insight would greatly be appreciated. 

16 comments
Comment actions Permalink

Pycharm 2021.3.3, Docker 20.10.13, plugin 213.7172.26

in my case helped adding user to docker group, log out/in, and then:

sudo chmod a+rwx /var/run/docker.sock
sudo chmod a+rwx /var/run/docker.pid
8
Comment actions Permalink

Hey, as you mentioned PopOS: Did you install via the popShop? Because it uses flatpak, i had to run this command to give IntelliJ access to the docker.sock (you probably have to change Intellij to PhpStorm)

flatpak override --user --filesystem=/run/docker.sock com.jetbrains.IntelliJ-IDEA-Ultimate

https://github.com/flathub/com.jetbrains.IntelliJ-IDEA-Ultimate/issues/22

5
Comment actions Permalink

@emc, thanks, it helped.
(If the error is with "(Details: [13] Access denied)", then this will help).

3
Comment actions Permalink

emc Brilliant! It works, ty!

1
Comment actions Permalink

emc thanks man it did work 

I was having this from last 2 days

1
Comment actions Permalink

Probably, logs could tell more here (Help > Collect Logs).

Also, I have a little bit silly question but nonetheless, could you please check if you have the correct version of a Docker plugin installed? ("Plugins" section) 

0
Comment actions Permalink

Hello

Looks like I do have the docker plugin installed:

 

Here is a link to the logs files: https://www.dropbox.com/s/jxblj9l9w1q4eod/php-storm-logs.zip?dl=0

0
Comment actions Permalink

Hi!

Thanks for attaching the log files pack. Unfortunately, there are no related errors excluding the obvious:


2020-12-16 19:36:02,897 [ 0] ERROR - .intellij.docker.agent.ApiTask - com.intellij.docker.agent.DockerAgentImpl$1@40bb2581
com.intellij.docker.agent.ApiTaskException: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

In the meanwhile, I have found a similar fresh report for the IDEA 2020.3:

https://youtrack.jetbrains.com/issue/IDEA-258012

There are no details yet but the input data looks the same (yep, the error is too generic for a direct comparison but nevertheless), so it could be useful to subscribe for that ticket and follow its progress.

By the way, I was wondering if it is an option for you to install the PhpStorm 2020.2.4 in parallel (with JetBrains Toolbox for instance). Will it work there?

0
Comment actions Permalink

Hello

It does work in 2020.2.4 it seems.  I will purge my 2020.3 and just use 2020.2.4 for now.

0
Comment actions Permalink

Hey,

Thanks for checking it, I have added an internal comment with this information to the YouTrack ticket mentioned above, hope it helps.

0
Comment actions Permalink

Could you please 

- add into the custom debug log settings (Main Menu | Help | Diagnostic Tools | Debug Log Settings...) the following line: 

#com.intellij.docker

- reproduce an issue 

- also, please launch the terminal tool window from the IDE, and launch `ls -la /var/run/docker.sock` there

- and attach the fresh IDE logs and the terminal output to the https://youtrack.jetbrains.com/issue/IDEA-258012

Thanks 

0
Comment actions Permalink

Michael Golubev Should I put the # before that setting?

0
Comment actions Permalink

> Should I put the # before that setting?

Yes, please paste the line exactly as specified. 

 

0
Comment actions Permalink

I have the same issue. The docker.sock is there. I can run docker without sudo. I even gave it 777 permissions and the IDE still says it can't find it. There's obviously a bug somewhere. (The logs aren't clear, they just mention the connection failing)

0
Comment actions Permalink

Is there a chance to share the logs pack (Help > Collect Logs and Diagnostic Data) & screenshots of your config? You can share them privately using https://uploads.jetbrains.com/

0
Comment actions Permalink

Just restart the pc. it worked for me after scratching my head for 2 hours

0

Please sign in to leave a comment.