microsoft / vscode-docker

Docker Extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker
Other
1.21k stars 515 forks source link

No containers/images/etc. listed in extension when docker is installed via snap package #3843

Open danegsta opened 1 year ago

danegsta commented 1 year ago

We've received a number of different reports recently of a particular bug on Linux systems that results in the Docker extension not showing any containers, images, etc. despite seeing one or more results when enumerating resources with the Docker CLI from the terminal. We've tracked down what we believe to be the most common root cause of the issue to the snap application sandbox blocking access to some resources when a snap install of Docker is called from a snap install of VSCode.

We're still investigating what would be required to fix this issue (or if it's something that would require an external fix somewhere like the Docker snap package itself), but we've identified a manual workaround that should unblock users of the extension. If you update the Docker Path property in your VSCode settings to /snap/docker/current/bin/docker the extension should start listing resources correctly again. If you see any errors after updating the Docker Path property, please double check that you installed Docker via snap and that it installed the Docker snap resources to the default path.

chardso commented 1 year ago

was facing the same challenge,but hope here after,my journey towards my career development gonna flourish.

cathalmchale commented 12 months ago

I'm running into this issue. I'm finding that docker tasks will execute successfully (albeit, no progress output in the console), but images, containers don't show in the extension UI.

However, if I update the Docker Path as above, the UI still not working, but I actually break the docker tasks now! This is an example of the error I get in the tasks console:

/snap/docker/current/bin/docker: /lib/x86_64-linux-gnu/libc.so.6: version GLIBC_2.32' not found (required by /snap/docker/current/bin/docker) /snap/docker/current/bin/docker: /lib/x86_64-linux-gnu/libc.so.6: versionGLIBC_2.34' not found (required by /snap/docker/current/bin/docker) Process exited with code 1

cathalmchale commented 12 months ago

Could it just be permissions? I've added my user to the docker security group. Is that the user that the extension UI assumes? The reason I ask is that, when I change the Docker Path setting, the UI has message like "Docker not found, are you sure it's installed", but if I get rid of that setting (so that tasks work - back to using command "docker" rather than "/snap/docker/current/bin/docker") then the UI simply says "No items found" for images and "Tutorial: Get started with Docker" for containers.

Actually, as I say this, it's probably not permissions, but rather that the console output is being suppressed, as observed in the (successful) Docker Task console.

SchuhMichael commented 11 months ago

I saw this on 6.2.0-34-generic #34~22.04.1-Ubuntu with snap installation latest/stable: d037ac07 2023-11-01 and Docker extension v1.27.0. In the terminal in code it gave /snap/bin/docker as output of which docker command. Setting the Docker Path variable to this value did not help. But surprisingly, setting it to /snap/docker/current/bin/docker worked. Looks to me like the link is not followed: /snap/bin/docker -> /usr/bin/snap

danegsta commented 11 months ago

The binary at /snap/bin/docker is a snap wrapper for the Docker binary which has additional sandboxing that fails when run from another snap wrapped app (the standard vscode install on Ubuntu is often a snap app). The Docker binary at /snap/docker/current/bin/docker is the raw Docker binary. I haven’t had a chance to check out the current state of the underlying issues, but last I checked, the errors are at the low level snap sandbox implementation and seem to be unrelated to Docker or VSCode specifically.

aalavandhaann commented 9 months ago

/snap/docker/current/bin/docker

You saved me one hell of a nightmare. Thank you very much. Your solution works for me.

Regards,

0K

pedroachagas commented 6 months ago

/snap/docker/current/bin/docker

Worked for me too, perfectly!