Should we really recommend vscode + podman as supported?

It took me some time to actually make devcontainers and podman work together.
The default commands from inside vscode don’t work properly, as there are extra settings needed (per-devcontainer) work properly when using podman (and also not nicely documented anywhere), specially under selinux (like fedora).

bluefin dev-ex main page states that vscode comes prepared to work with podman, but that seems misleading.

Would not be better to direct people to install docker if they intent to use devcontainers and vscode in bluefin, at least until devcontainers works “by default” with podman ?

Yeah, we can recommend whatever works best. What was involved in getting it to work with podman? I switched over a while ago so I haven’t done a clean install to check that in a while.

the lines I had to add to my devcontainer.json where:

"runArgs": [
		"--userns=keep-id",
		"--security-opt=label=disable"
	  ],
"containerEnv": {
		"HOME": "/home/vscode"
	},

this for the default rust devcontainer image.

The default “try devcontainer sample” fails because of the lack of docker.socket .

The default file generated by the default “add devcontainer conf file” will fail because of some root user mismatch. if we run as root , then we get permission denied on the mounted workspace and the files are not accessible.

The “new devcontainer” command fails with the same problem

setting “keep-id” and forcing the devcontainer to use the non root user from the image solved the “boot without root” problem, but the workspace is still not acessible because of selinux.

All of that I found after jumping through several half solved github :confused: . There are other possibilities to solve the problem that involve mounting the workspace manually inside your devcontainer, using the “Z” (which will relabel the files in your workspace), forcing everything to run as root , …

The experience to understand (and solve) is confusing and quite frustrating. It’s easy to do the wrong thing if we don’t understand the pieces involved, and is not that hard to end with a scenario that “kinda works”, but will reloabel your files, or change their permission

I’m don’t believe a regular “devcontainer.json” from a public project will work inside podman without change.

I would not recommend that as a “paved road” for someone that just wanna "have things works"™ .

Docker seems to be the “no friction” option for now and it would be better to recommend that instead of podman.

Edit: adding some references where I found those configurations

Ok filed this as an issue!

From my understanding selinux part is problematic on docker as well not just podman that is because devcomtainers dont integrate with selinux, in my opinion this should be solved at a system level not by swapping podman for docker which from my understanding does nothing for this issue and just makes worse experiance with uswr needing to be added to right group and such

It does not seem to be the case.
I did enable docker here, removed all my ‘extra’ flags… Everything just works™. All vs code commands, generated files, samples, etc… All out of the box without “special” arguments

2 Likes

Granted, it’s not apples to apples, but I’ve been using vscode with podman just fine for months, if not as much as a year, on openSUSE Kalpa and distrobox. Seems like if distrobox can make it work, it’s not something that can’t be done.

Is how it’s done over there (granted, that’s not “integrated” and ready to run, but it seems like it’s something that could be adapted and shipped within bluefin/ublue if somebody were interested in doing it.

yes, it can be done. it’s just that it does not work “out of the box” with devcontainers and podman (which is not the same as using just remote containers as indicated in the link).

1 Like

Most likely your dockerd is not running with --selinux-enabled so Docker is not doing SELinux stuff.

These fields could be set in a containers.conf file, which can be dropped in /etc/containers/containers.conf.d directory at install time.

Most likely your dockerd is not running with --selinux-enabled so Docker is not doing SELinux stuff.

Not sure, I’m running with the default flags set by from “just docker” , so, its whatever a new user would have.

I added the flags the containers.conf. That “solves” the selinux problem, but the problem regarding workspace mapping and remote user persists and I believe can’t be solved on a general user config.

I only managed to make it work using a handcrafted Dockerfile (as I did before), instead of the regular files created by vscode (which would be what a regular user would get if he was colaborating with other users).

Well that’s a start, we can fix the just docker snippets to do that. :smile:

There is nothing wrong with docker. It works out of the box without any problems after we remove the settings from vscode to use podman and enable it with just docker.
The problem is the combination vscode + devcontainers (extension) + podman …

I believe I poorly choose my works for the title, I should have said vscode + devcontainers + podman …
I quote Bluefin-dx page here:

Visual Studio Code

[Visual Studio Code] is included on the image to facilitate local development. It comes configured for usage with devcontainers and Podman via a small [default configuration file ].

  • [Dev Containers Documentation ] - you can skip most of the installation instructions and go directly to [the tutorial ]
  • [Dev Containers Specification ]
  • [Beginner’s Series to: Dev Containers ]/watch?v=b1RavPr_878) - great introductory tutorial from the [VS Code YouTube channel ]

That is the main problem I see: vscode + devcontainers + podman is not working out of the box, and I believe it’s not possible to make it work out of the box (currently)… A user can make it work, but the docs give the wrong impression about what a user will get out of the box currently.

2 Likes

I think it’s possible to edit the title after the post has been created :slight_smile:

BTW @fdr,
Is the error you get while using VSCode command palette this one :

?

If so, that would explain why I got trouble setting it up.

A lot of issues with devcontainers is that the extensions and features often make giant assumptions about your environment. You are also assuming to use docker or containerd and not OCI complaint images. Docker is now more or less compliant with Podman we need to accept it. It’s like X is better than JS there’s no reason to change. The problem is bad dev container files.

Look at this one from gVisor (Google hypervisor) probably generated by bazel:

They have three ways to make the project like make, bazel or I am guessing this file. Podman might catch up but it’s industry standard now for Docker.

So what should be the default minimal addition to .devcontainer/devcontainer.json file to make Podman run on SELinux ?

So far I’ve seen 3 versions, but I don’t know which is the best, and what some options really does and why do they work

1

"runArgs": [
	"--userns=keep-id"
],
"containerEnv": {
	"HOME": "/home/node"
}

2

"runArgs": [
	"--userns=keep-id:uid=1000,gid=1000"
],
"containerUser": "vscode",
"updateRemoteUserUID": true,
"containerEnv": {
	"HOME": "/home/vscode"
},

3

"runArgs": [
	"--userns=keep-id",
	"--security-opt=label=disable"
],
"containerEnv": {
	"HOME": "/home/vscode"
},

Related:

It’s been some time already, but I believe that that was error .

1 Like

@j0rge, to fix this issue, instead of recommending Docker,

Would you consider introducing gVisor or Quark ?

I’m confused, what issue are you trying to solve?