Docker socket is not found while using Intellij IDEA and Docker desktop on MacOS - docker

I downloaded Docker using Docker Desktop for Apple M1 chips. I can run containers, the integration with VsCode works okay but I can't integrate it with Intellij IDEA Ultimate. It keeps giving this error.
But I can run my containers and create images from the terminal, I can also see the containers and images in Docker Desktop too. What could be the reason behind this? I also tried to check whether var/run/docker.sock is existing and it really isn't, there is no such file as that.
I also tried the same steps on my second computer and the exact same thing happened. Steps to reproduce: 1- Download Intellij IDEA Ultimate, open a repo that uses docker 2- Download Docker Desktop for Mac M1 3- Try to add Docker service to Intellij
I didn't do anything else because I think Docker Desktop is enough to configure everything on Mac. I am trying to run an FT on intellij and I get the error
[main] ERROR o.t.d.DockerClientProviderStrategy - Could not find a valid Docker environment. Please check configuration. Attempted configurations were:
[main] ERROR o.t.d.DockerClientProviderStrategy - UnixSocketClientProviderStrategy: failed with exception InvalidConfigurationException (Could not find unix domain socket). Root cause NoSuchFileException (/var/run/docker.sock)
[main] ERROR o.t.d.DockerClientProviderStrategy - DockerMachineClientProviderStrategy: failed with exception ShellCommandException (Exception when executing docker-machine status ). Root cause InvalidExitValueException (Unexpected exit value: 1, allowed exit values: [0], executed command [docker-machine, status, ], output was 122 bytes:
Docker machine "" does not exist. Use "docker-machine ls" to list machines. Use "docker-machine create" to add a new one.)
[main] ERROR o.t.d.DockerClientProviderStrategy - As no valid configuration was found, execution cannot continue
I've been trying everything for the last 2 days but I can't seem to find a solution.

EDITED 2022-10-31
As per the latest release notes for Docker Desktop (4.13.1), there is no need to create the symlink anymore, citing notes:
Added back the /var/run/docker.sock symlink on Mac by default, to increase compatibility with tooling like tilt and docker-py. Fixes docker/for-mac#6529.
The official fix now is to UPGRADE your Docker Desktop installation.
For the Docker Desktop (4.13.0) version:
By default Docker will not create the /var/run/docker.sock symlink on the host and use the docker-desktop CLI context instead. (see: https://docs.docker.com/desktop/release-notes/)
That will prevent IntelliJ from finding Docker using the default context.
You can see the current contexts in your machine by running docker context ls, which should produce an output like:
NAME TYPE DESCRIPTION DOCKER ENDPOINT KUBERNETES ENDPOINT ORCHESTRATOR
default moby Current DOCKER_HOST based configuration unix:///var/run/docker.sock https://kubernetes.docker.internal:6443 (default) swarm
desktop-linux * moby unix:///Users/<USER>/.docker/run/docker.sock
As a workaround that will allow IntelliJ to connect to Docker you can use the TCP Socket checkbox and put in the Engine API URL the value that appears under DOCKER ENDPOINT in the active context.
The case for this example will be: unix:///Users/<USER>/.docker/run/docker.sock
Then IntelliJ will be able to connect to Docker Desktop.
**Hacky option**
Another way to make IntelliJ (and other components that rely on the default config) to find Docker will be to manually create a symlink to the new DOCKER ENDPOINT by running:
sudo ln -svf /Users/<USER>/.docker/run/docker.sock /var/run/docker.sock
In that way all the components looking for Docker under /var/run/docker.sock will find it.

Related

IDEA can't see docker desktop containers on ARM macOS

I downloaded Docker Desktop for Mac and I can run docker-compose up but when I try to run a functional test I get the error
java.lang.IllegalStateException: Could not find a valid Docker environment. Please see logs and check configuration
and when I check the logs I see that it is about docker machine I believe.
[main] ERROR o.t.d.DockerClientProviderStrategy - Could not find a valid Docker environment. Please check configuration. Attempted configurations were:
[main] ERROR o.t.d.DockerClientProviderStrategy - UnixSocketClientProviderStrategy: failed with exception InvalidConfigurationException (Could not find unix domain socket). Root cause NoSuchFileException (/var/run/docker.sock)
[main] ERROR o.t.d.DockerClientProviderStrategy - DockerMachineClientProviderStrategy: failed with exception ShellCommandException (Exception when executing docker-machine status ). Root cause InvalidExitValueException (Unexpected exit value: 1, allowed exit values: [0], executed command [docker-machine, status, ], output was 122 bytes:
Docker machine "" does not exist. Use "docker-machine ls" to list machines. Use "docker-machine create" to add a new one.)
[main] ERROR o.t.d.DockerClientProviderStrategy - As no valid configuration was found, execution cannot continue
but I believe Docker Desktop should be enough for MacOS, not confident though. I tried to create a docker machine but I couldn't because it needs a virtualbox but virtualbox doesn't support M1 macs. Don't know what to do here to be honest.
I can see the container up and running in Docker Desktop,the docker-compose up also runs. It seems like IntellijIDEA can't see it? Also when I try to add Docker to IntellijIDEA from Preferences -> Build, Execution, Deployment -> Docker, I also get the error
Cannot connect: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? (Details: [2] No such file or directory)
Can anyone assist me with this?
Edit: I actually checked var/run and there is no such file as docker.sock. Why is this, I am so confused.

error during connect: The system cannot find the file specified..,the docker client must be run elevated to connect [duplicate]

System info:
Windows 10 pro 64 bit
C:\WINDOWS\system32>docker --version
Docker version 18.06.1-ce, build e68fc7a
C:\WINDOWS\system32>docker info
error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.38/info: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.
C:\WINDOWS\system32>docker pull hello-world
Using default tag: latest
Warning: failed to get default registry endpoint from daemon (error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.38/info: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.). Using system default: https://index.docker.io/v1/
error during connect: Post http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.38/images/create?fromImage=hello-world&tag=latest: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.
You can powerShell as admin.
Run this code:
cd "C:\Program Files\Docker\Docker"
./DockerCli.exe -SwitchDaemon
Running Powershell with elevated access solved my issue.
Usually this error means the Docker daemon that is docker services is not up and running.
Make sure docker is running by issuing below command in power shell in elevated mode.
docker run hello-world
A response as hello from docker will be printed on console.
Else start the docker by double clicking the docker app from start menu.
Below is the snapshot of graphically up and running docker daemon.
On Windows, go to the folder %homepath%\.docker, open daemon.json and if debug is set to true then set it to false.
I had the same error as in the question and after I changed the above it worked again for me. After I got the error, I had been looking at the various docker settings and decided to set debug to false because I don't need any daemon debug info for what I'm doing. I don't know why it was set to true originally.
In my case, although I had the docker service running as admin and the service was shown as running, it was not.
Open the docker desktop app, click on the 'troubleshoot' icon. Check if the service is effectively running (bottom left). If it's not, try to 'clean/purge data', and then restart the service. It worked for me!
Verify it by running docker run hello-world
Fow Windows:
Launch command: "C:\Program Files\Docker\Docker\DockerCli.exe" -SwitchDaemon
This error is because of organisation network certificates which are installed in local machine. Beacuse some companies restricted network by installing certificates.
docker daemon service is not running on my machine and when I start the service, this error us resolved.
I had faced the same error, the following worked for me:
In the windows taskbar, the docker icon was red in color saying Out of Memory...
In the Docker Desktop App, goto
Settings -> Resources -> Disk Image Size -> decrease the space allocated -> Apply & Restart
This did happen to me while i was using docker today for the first time. I fixed by opening up the docker app in the PC and signing and selecting the necessary subscription plan.
Open docker with docker <homepath>. Simply upgrade docker and then run this command
docker-compose up -d
you will be able to solve the specified path error.
docker.errors.DockerException: Error while fetching server API version: (2, 'CreateFile', 'The system cannot find the file specified.')
[14620] Failed to execute script docker-compose
Doing the above solved the error.
Yo,
open docker app > settings > Docker engine > "debug": true,
debug was false initially, after changing it to "true" it worked.
Thanks.

Sharing docker credentials between Window and WSL

Environment
Windows version and build Version 2004 (OS Build 19037.1)
Docker Edge version 2.1.6.1
Ubuntu 18.04 on WSL 2
Current setup and status:
docker installed on windows
created aliases for docker, docker-compose, docker-credential-desktop, etc ...
Running commands such as docker build, docker ps, docker pull, docker images all work fine. Now I would like push an image and so of course I have to login first.
Problem: logging into docker hub.
I run docker login in the WSL terminal
I put in my username and password
I get the following error
Error saving credentials: error storing credentials - err: exec: "docker-credential-desktop": executable file not found in %PATH
%, out: ``
What I've tried so far
docker login from powershell works fine. So I created a symbolic link between /mnt/c/Users/<winusername>/.docker and /home/<wslusername>/.docker. The equivalent works fine for .aws, but for .docker it was not able to share or even acknowledge the credentials, so it asked again for the user and password and threw the same error as above.
This worked for me,
sudo ln -s /mnt/c/Program\ Files/Docker/Docker/resources/bin/docker-credential-desktop.exe /usr/bin/docker-credential-desktop.exe
Linking the executable from windows path to linux path or you can add the windows PATH on you linux PATH.
Refer: https://github.com/docker/for-win/issues/6652
Update Feb 2021
This is all much simpler now. If you are using WSL2 on a recent release of Windows, just install docker on the Windows side and ensure to configurations:
In General: us the WSL 2 based engine
In Resource/WSL Integration: enable integration with your default WSL distro
You will have to restart docker. Once it is done, everything works transparently.
Below here can be ignored
It turns out that the integration between Docker and WSL is better than I thought. Though it could have been better documented. I was going to change tack and try to install docker in the WSL. So I got rid of all the aliases and restarted my session. Lo and behold, when I ran docker there was still something running.
This is because the edge version of docker create the appropriate symbolic links and now I login into docker hub without any problem.

error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.38/info

System info:
Windows 10 pro 64 bit
C:\WINDOWS\system32>docker --version
Docker version 18.06.1-ce, build e68fc7a
C:\WINDOWS\system32>docker info
error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.38/info: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.
C:\WINDOWS\system32>docker pull hello-world
Using default tag: latest
Warning: failed to get default registry endpoint from daemon (error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.38/info: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.). Using system default: https://index.docker.io/v1/
error during connect: Post http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.38/images/create?fromImage=hello-world&tag=latest: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.
You can powerShell as admin.
Run this code:
cd "C:\Program Files\Docker\Docker"
./DockerCli.exe -SwitchDaemon
Running Powershell with elevated access solved my issue.
Usually this error means the Docker daemon that is docker services is not up and running.
Make sure docker is running by issuing below command in power shell in elevated mode.
docker run hello-world
A response as hello from docker will be printed on console.
Else start the docker by double clicking the docker app from start menu.
Below is the snapshot of graphically up and running docker daemon.
On Windows, go to the folder %homepath%\.docker, open daemon.json and if debug is set to true then set it to false.
I had the same error as in the question and after I changed the above it worked again for me. After I got the error, I had been looking at the various docker settings and decided to set debug to false because I don't need any daemon debug info for what I'm doing. I don't know why it was set to true originally.
In my case, although I had the docker service running as admin and the service was shown as running, it was not.
Open the docker desktop app, click on the 'troubleshoot' icon. Check if the service is effectively running (bottom left). If it's not, try to 'clean/purge data', and then restart the service. It worked for me!
Verify it by running docker run hello-world
Fow Windows:
Launch command: "C:\Program Files\Docker\Docker\DockerCli.exe" -SwitchDaemon
This error is because of organisation network certificates which are installed in local machine. Beacuse some companies restricted network by installing certificates.
docker daemon service is not running on my machine and when I start the service, this error us resolved.
I had faced the same error, the following worked for me:
In the windows taskbar, the docker icon was red in color saying Out of Memory...
In the Docker Desktop App, goto
Settings -> Resources -> Disk Image Size -> decrease the space allocated -> Apply & Restart
This did happen to me while i was using docker today for the first time. I fixed by opening up the docker app in the PC and signing and selecting the necessary subscription plan.
Open docker with docker <homepath>. Simply upgrade docker and then run this command
docker-compose up -d
you will be able to solve the specified path error.
docker.errors.DockerException: Error while fetching server API version: (2, 'CreateFile', 'The system cannot find the file specified.')
[14620] Failed to execute script docker-compose
Doing the above solved the error.
Yo,
open docker app > settings > Docker engine > "debug": true,
debug was false initially, after changing it to "true" it worked.
Thanks.

pending jenkins doesn't have label docker-slave

I am trying to configure jenkins slave as docker container, have enabled docker API and connections works fine to the API
Have added the configuration for docker template and docker cloud but it seems that my job does not starts
I can see container getting created on my docker node but the job does not start
Docker cloud configuration image
docker template image
One thing to note is that when i run the container specifically on the docker node and then try to ssh using the same credentials that i am using in jenkins i can ssh into the container.
This message of "Jenkins doesn't have label XXXX" is rather misleading and unhelpful.
You think the problem is something you did wrong in your configuration and when you find out what happen it is nothing to do with jenkins or how you set up the docker plugin.
I run into the same problem than you, and the problem was the docker installation I was using.
The steps I followed to fix it were:
(I was using CENTOS7,jenkins 2.1.38, docker version 1.13.1)
1) Go to the logs of your jenkins (centos logs are /var/log/jenkins.log)
2) Looking into the logs you are going to find out the problem. For instance for me was this:
com.github.dockerjava.api.exception.NotFoundException: {"message":"driver failed programming external connectivity on endpoint happy_heyrovsky (cbfa0d43f8c89d2531323249468503be11e9dd603597a870530d28540c662695): exec: \"docker-proxy\": executable file not found in $PATH"}
As you see the problem is that docker it is not able to find docker-proxy ¿how to fix this?
Go to /usr/libexec/docker and you will see docker-proxy-current. so what you have to do is create a link:
sudo ln -s docker-proxy-current docker-proxy
Tha´s all. After doing this change I execute my build on jenkins and it works.

Resources