I'm facing an issue when using podman and --network=host combination:
Environment
@devcontainers/cli: 0.88.0
- Podman client/server: 5.7.1
- Host: WSL2
- Podman server: rootful
Problem
For Podman on Linux and a non-root remoteUser, Dev Containers automatically adds:
--security-opt label=disable --userns=keep-id
See #1004 and microsoft/vscode-remote-release#10399.
When the configuration also requires --network=host, the container fails to start.
Minimal underlying reproducer
This fails:
podman run --rm \
--network=host \
--userns=keep-id \
docker.io/library/alpine:3.20 \
true
Error:
crun: mount `sysfs` to `sys`: Operation not permitted: OCI permission denied
Without --userns=keep-id, it succeeds:
podman run --rm \
--network=host \
docker.io/library/alpine:3.20 \
true
The CLI-generated podman run command contains both:
--userns=keep-id --network=host
The automatic argument is added in:
src/spec-node/singleContainer.ts
getPodmanArgs()
Expected behavior
Users must be able to prevent the CLI from adding --userns=keep-id.
Possible fixes
No one is perfect I'm afraid.
- Do not add
--userns=keep-id when --network=host is present.
- Add a setting or CLI option to disable automatic Podman arguments.
- Respect an explicit
--userns=... in runArgs and do not add --userns=keep-id.
- Make automatic
--userns=keep-id opt-in instead of unconditional for non-root users.
Big thanks.
I'm facing an issue when using podman and
--network=hostcombination:Environment
@devcontainers/cli: 0.88.0Problem
For Podman on Linux and a non-root
remoteUser, Dev Containers automatically adds:See #1004 and microsoft/vscode-remote-release#10399.
When the configuration also requires
--network=host, the container fails to start.Minimal underlying reproducer
This fails:
podman run --rm \ --network=host \ --userns=keep-id \ docker.io/library/alpine:3.20 \ trueError:
Without
--userns=keep-id, it succeeds:podman run --rm \ --network=host \ docker.io/library/alpine:3.20 \ trueThe CLI-generated
podman runcommand contains both:The automatic argument is added in:
Expected behavior
Users must be able to prevent the CLI from adding
--userns=keep-id.Possible fixes
No one is perfect I'm afraid.
--userns=keep-idwhen--network=hostis present.--userns=...inrunArgsand do not add--userns=keep-id.--userns=keep-idopt-in instead of unconditional for non-root users.Big thanks.