Skip to content

Build forces $_REMOTE_USER to root even if "remoteUser" is given #1991

Description

@p0lar-bear

What happened?

When I try to build a devcontainer from an image with only a root user, Nils Geistmann's create-remote-user feature, and a specified remoteUser that isn't root, it fails with an error.

What did you expect to happen instead?

I expected DevPod to build the containers without error and launch my chosen IDE.

How can we reproduce the bug?

See my demonstration repo.

Local Environment:

  • DevPod Version: 0.6.15
  • Operating System: linux
  • ARCH of the OS: AMD64

DevPod Provider:

  • Local/remote provider: docker | ssh

Anything else we need to know?

I'm building a devcontainer leveraging docker compose, and among my chosen features is Nils Geistmann's create-remote-user. This feature is used to check for and create the user given as the remoteUser if it doesn't exist. The container specified by service is based on python:3.14-trixie which only comes with a root user. There is a postcreate script that performs some initial setup (e.g. running npm install, uv sync, etc).

When I build the containers with devcontainer-cli, it works without issue - the containers in the compose are created and show in docker ps as running.

When I use DevPod and it errors, I notice two things in the build log:

  1. A notice is given from the create-remote-user feature that the value of the $_REMOTE_USER evironment variable is root, so it does nothing and exits gracefully.
  2. When the postcreate script is reached, it will fail because the specified remoteUser does not exist when it attempts to run su.

I can work around this by creating a Dockerfile that wraps python:3.14-trixie and sets the container user, but I'd like to be able to use the feature that was created to specifically address this use-case. Based on devcontainer-cli's behavior and how this is a popular feature in devcontainer setups (enough that multiple help articles and blog posts suggest to use it), I conclude that the incorrect $_REMOTE_USER environment variable is being given to container features at build time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions