I'm not able to make it working :( I have a setup where I connect using SSH to a remote server where I'm running several docker containers in a rootless-docker configuration.
I'm able to see the docker containers in VSCode and also to Attach shell to any of them.
However when trying to Attach Visual Studio Code I get the following error output:
[644094 ms] Start: Run in Host: docker version --format {{.Server.APIVersion}}
[644194 ms]
[644194 ms] Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
As you can see, it is trying to use unix:///var/run/docker.sock instead of unix:///var/run/user/1001/docker.sock which I configured in my workspace settings.json file:
{
"docker.environment": {
"DOCKER_HOST": "unix:///run/user/1001/docker.sock"
}
}
I have also enable rootless context under the Contexts menu.
Any idea why Attach shell is working while Attach Visual Code is not. I have read many of the solutions here and there, and tested them without success.
Edit:
I have also tried using the following settings.json but it doesn't work.
{
"docker.environment": {
"DOCKER_HOST": "ssh://jlanza#myserver.hostname.eu"
}
}
Related
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.
I have been using VS code for several months to connect to a running Docker container on another machine. I run VS code from my local Windows machine and use the Remote SSH extension to connect to a remote Ubuntu machine which is running a docker container. As of yesterday, I am no longer able to access the container and the application seems to hang.
I have made sure that my container is running on the remote machine. My steps are:
"Open a Remote Window" > "Connect to Host..."
Connect via SSH
"Open a Remote Window" > "Attach to Running Container..."
I get a pop-up on the bottom-right of the screen saying "Setting up Remote-Containers (show log)" and when I open the log I see the following:
[11584 ms] Remote-Containers 0.251.0 in VS Code 1.71.2 (74b1f979648cc44d385a2286793c226e611f59e7).
[11584 ms] Start: Run: ssh <machine name> /bin/sh
[11593 ms] Start: Run in host: id -un
It appears to hang here indefinitely.
I am able to attach to the container in the terminal, so there doesn't seem to be an issue with the way the container is set up. Does anyone have any ideas what might be causing this?
How can I restart docker daemon running in rootless mode on Linux?
Stopping it works fine with:
docker --user stop docker.service
but starting it back again fails when using:
docker --user start docker.service
The command doesn't return anything but when checking the docker info it says:
ERROR: Cannot connect to the Docker daemon at unix:///run/user/1000/docker.sock. Is the docker daemon running?
It doesn't give any further information...
I had this error a couple of times before, when I accidentally run docker with sudo and therefore got mixed up permissions in my data-root (defined in daemon.json). But this time chowning it back to $USER didn't help with the restart. Also restarting the host machine didn't help (as it did a couple of times previously).
Ok, it seems that "userns-remap" is not compatible with rootless mode:
Rootless mode executes the Docker daemon and containers inside a user namespace. This is very similar to userns-remap mode, except that with userns-remap mode, the daemon itself is running with root privileges, whereas in rootless mode, both the daemon and the container are running without root privileges. Rootless mode does not use binaries with SETUID bits or file capabilities, except newuidmap and newgidmap, which are needed to allow multiple UIDs/GIDs to be used in the user namespace.
I was trying to fix permission issues on shared volumes by experimenting with setting UIDs/GIDs and added "userns-remap" to the ~/.config/docker/daemon.json:
{
"data-root": "/home/me/docker/image-storage",
"userns-remap": "me"
}
So deleting userns-remap from the config file fixed the restarting issue... Man, docker, at least a hint to the config file would be great... Because the userns-remap option was mentioned on some official docker doc pages I didn't even consider it as the source of the trouble in the first place.
I'm new to using Docker (never used it before) and I'm running into these errors:
I installed the Docker for Windows and following the steps on this
tutorial, but Docker Desktop doesn't load up for me at all.
I tried to run the docker pull hello-world command but I'm getting the error: 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.
How do I fix this? Thanks
I am new to the world Docker'm having trouble running the first time.
The facility was quiet, however there trying to check existing container, it shows the following message:
Can not connect to the Docker daemon. Is the running daemon docker on this host?
I've done the start of the daemon to the test reported in the docker documentation I tested is normal and prowling, however to continue the steps displays the message reported above.
By default, the docker command runs for its own group or root users. Make sure you type prefix the command you're using with sudo. Alternatively, you can add your current user to the docker group by running sudo usermod -aG docker $USER.
Source: the official documentation.