images/universal: preserve upstream user environment when switching to coder#331
Closed
matifali wants to merge 2 commits into
Closed
images/universal: preserve upstream user environment when switching to coder#331matifali wants to merge 2 commits into
matifali wants to merge 2 commits into
Conversation
bpmct
approved these changes
May 12, 2026
Member
Author
|
Closing in favor of #332, which uses a direct branch in The direct PR also includes the local Docker CLI validation and a follow-up fix for login shells preserving Coder's injected
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Rename the upstream
codespaceuser tocoderinstead of deleting it and creating a fresh account.Why
The universal image is built on top of
mcr.microsoft.com/devcontainers/universal, which is configured around the existingcodespaceuser and its home directory. Recreating the user leaves behind shell and PATH behavior that still assumes/home/codespace.In Coder workspaces this can surface as login shells dropping the injected
coderCLI fromPATH, causingcoder: command not foundin some terminal flows.I reproduced that behavior in a real workspace from the Docker template:
bash -c 'command -v coder'worksbash -lc 'command -v coder'failsPreserving the upstream account avoids that mismatch and keeps the base image's home directory and shell environment coherent.
Changes
userdel -r codespace+useradd coderwithusermod/groupmod/home/codercoderin thedockerandsudogroupsExpected result
Login-shell behavior remains consistent with the upstream devcontainer image while still exposing the user as
coderfor Coder workspaces.