Skip to content

Root user inside a devcontainer

It seems that it is normal to run as user root inside a devcontainer.

Both Docker Desktop and Podman map the current host user to the user root inside the container. Together with a bind mount of my source files into the /workspace folder inside the container, this works seamlessly.

So far, my attempts to run as non-root user inside the container have resulted in issues around file ownership. The solutions I have seen so far (until early 2026) all require a lot of extra work with scripts and so on.

The easiest way is to just accept to run as root inside the devcontainers I use.