Is there a way for remoteUser to re-use an existing user, but rename it? #158
larsnystrom
started this conversation in
Ideas
Replies: 1 comment
-
Hi 👋 Your approach using build arguments and conditional user modification in the Dockerfile is a good workaround. However, as of now, there isn't a built-in way in devcontainer.json to rename an existing user directly. Feel free to reopen an issue in https://github.com/devcontainers/spec and we can start working on it once we receive similar user interest. Thanks! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I work in a corporate environment, where the IT department have given me a username which is used across all hosts I manage. I'd like to use this username inside the devcontainer, but without committing it because I want my colleagues to be able to use the same devcontainer configuration. Re-using my corporate username helps when SSH:ing to other hosts, etc.
What I've been doing is to add
"remoteUser": "${localEnv:USER}"
todevcontainer.json
. This has been working fine, as the user is created if it doesn't exist. However, I've recently hit a situation where I need the user to exist in theDockerfile
so that I can install some things in the user-directory while creating the image. So what I've done now is I addRUN adduser code
to my Dockerfile to create acode
user, then I install what I need for it, and finally I want to rename thecode
user to my corporate username.The problem is that I can't figure out how to rename the user from the
devcontainer.json
file. UsingremoteUser
will just create a new user.Is there some option to re-use an already existing user in the image and rename it?
Basically I want
remoteUser
but with an additionalrenameUser
option, which should take the username of a user which must exist in the image and which should be renamed to the username ofremoteUser
.I've kind of solved this for now by adding the build arg
"LOCAL_USERNAME": "${localEnv:USER}"
and the following to the end of my Dockerfile:However, I think a built in way to do this would be helpful.
Beta Was this translation helpful? Give feedback.
All reactions