Vscode + devcontainers

Hi all,

First post here, so apologies if it’s already been resolved.

I posted the question on vscode issues board, but not sure it’s the right place for it: fedora silverblue + dev containers (docker/podman) · Issue #7802 · microsoft/vscode-remote-release · GitHub Hope I can get some guidance here, thanks in advance!

I am having a difficult time getting vscode + dev containers extensions working on fedora silverblue 37.1.7. On paper, the idea behind the os is very appealing, I just can’t figure out how to properly configure vs code and that extension. Here is what I tried so far and every time I am getting the same problem: vscode does not work correctly with docker/podman.

  • docker installed directly on the host machine (through rpm-ostree)
  • my user can execute docker commands
  • vs code installed through flatpak (and I can confirm I can invoke docker commands from the vs code terminal)
  • vs code installed directly on the host machine (through rpm-ostree and I can confirm I can invoke docker commands from the vs code terminal)
  • vs code configured to use podman (podman comes preinstalled in that os) instead of docker

In that last scenario (preinstalled podman + vs code configured to use podman instead of docker for dev containers), I am getting a silent failure when opening a repository in a dev container. When I check the output terminal which starts when the dev container is opening, I get the following message:

2023-01-06 19:40:13.076 [error] {"message":"Command failed: /usr/share/code/code --ms-enable-electron-run-as-node /var/home/piotrjustyna/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/dist/spec-node/devContainersSpecCLI.js read-configuration --workspace-folder /var/home/piotrjustyna/Documents/code/haskell-anywhere --log-level debug --log-format json --config /var/home/piotrjustyna/Documents/code/haskell-anywhere/.devcontainer/devcontainer.json --include-merged-configuration --mount-workspace-git-root true","code":1} remote-containers.reopenInContainer {"value":"ms-vscode-remote.remote-containers","c":"ms-vscode-remote.remote-containers"}

When I use vs code with docker (instead of podman), vs code complains with a dialog upon opening a directory in a dev container which states:

Current user does not have permission to run 'docker'. Try adding the user to the 'docker' group (Cancel/Documentation)

even though I can execute docker commands from the vs code terminal (whoami ran in vs code terminal indicates that I’m running the command as myself). The Documentation button leads to the following resource: Docker Engine post-installation steps | Docker Documentation but that is unfortunately not 100% applicable in an immutable os.

So what I’m really reporting is a number of potential problems and maybe also a general question: is there a best practices document which handholds users trying to simply:

  • set up an immutable os
  • set up vs code
  • install the dev cotnainers externsion
  • get coding

a wiki like that would be very useful.

  • VSCode Version: 1.74.2
  • Local OS Version: fedora silverblue 37.1.7
  • Local chip architecture: x64
  • Reproduces in: Remote - Containers
  • Name of Dev Container Definition with Issue: irrelevant, problems using containers in general (docker + podman)

Steps to Reproduce:

  1. open a directory in a remote container
1 Like

How is vscode installed? I’m using the flatpak for it on Kinoite. If it’s a flatpak, you might be able to tweak it with flatseal.

Thanks @vwbusguy It is now installed through flatpak and I did experiment with flatseal but no joy. I guess what would be really handy is to get a more experienced silverblue user to see what kind of permissions does vscode need to execute docker commands on the host machine. I am happy to turn it into a documentation page/public walkthrough for new users. I believe this could unlock silverblue for many users like me.

This might be useful: distrobox/integrate_vscode_distrobox.md at main · 89luca89/distrobox · GitHub

1 Like

Thanks, I’ll try it as soon as I find a minute.