top | item 38710383

(no title)

TrickardRixx | 2 years ago

I like to develop with VS Code and devcontainers. I've never been able to get that setup to work with podman as the backend. Has anyone successfully done this or perhaps know of a blog detailing how to accomplish this that I haven't been able to find?

discuss

order

tedheath123|2 years ago

Yes, I have docker as an alias to root podman and VS Code is able to build a devcontainer with it. Rootless also works but was a lot slower for me. There are a couple of minor incompatibilities I've noticed in other areas:

* Podman doesn't have a unix socket like /var/run/docker.sock but it can be set up with podman-system-service if needed.

* Some applications check if /.dockerenv exists. They shouldn't, but you can just touch a file there to work around it.

zamalek|2 years ago

I think I did at one point. Podman is 1:1 compatible with the docker CLI. I _think_ VSCode had an option to specify the docker command, in which case you can simply `podman` into it. Alternatively, if that doesn't then you can always put this script in your path as `docker`:

    #!/bin/sh
    exec podman "$@"
Edit: if you're on Windows then the simplest approach would be to copy podman.exe to docker.exe.

tao_at_garden|2 years ago

Podman as a devcontainers engine doesn't currently work rootlessly (the default) if you use devcontainer features [1] or (and this sounds like you're issue) if you use WSL2.

I haven't submitted the WSL2 issue to the Podman team yet. If you get to it before I do, can you link it here?

I've worked around the features bug by just using `devbox generate devcontainer` then adding all my desired container apps and services inside a `devbox.json` file.

[1] https://github.com/containers/podman/issues/18691#issuecomme...

notnullorvoid|2 years ago

VS Code devcontainers have been working fine for me with rootless podman in Fedora for over a year now. The one adjustment I had to make was manually provide args to podman to mount the workspace volume:

  "runArgs": [
    "--userns=keep-id",
    "--volume=${localWorkspaceFolder}:/workspaces/${localWorkspaceFolderBasename}:Z"
  ],

I'm not sure if this is still necessary, or if it's necessary on all platforms.

vially|2 years ago

I've been using VSCode with devcontainers and podman for a couple of months now and everything seems to work fine for me. Is there a particular issue you're hitting?

TrickardRixx|2 years ago

Honestly, it's been a long time; I should probably just try again. The last attempt I made was on windows before WSL2 existed. At the time I assumed the issue was with podman on HyperV/WSL.

neurostimulant|2 years ago

If everything else fails, you can always run code-server inside a podman container.