-
Notifications
You must be signed in to change notification settings - Fork 315
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
The ${localEnv:UID}
is not expanded in devcontainer.json
so Dockerfile can't use a custom UID/GID during build time
#6834
Comments
One workaround is following:
So it can be following the setup:
Seems like a hacky solution, but works:
|
|
This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines. Happy Coding! |
i found out that if i add "export UID" to my ~/.bash_profile it solves this issue |
I have a following shortened Dockerfile:
Then I am building it locally with the current user UID/GID:
And then
/opt/dir
has expected file permissions anddev
has expeceted ID/GID:So far so good.
When I want to use the VS Code and utilize the Remote Containers, I go into the troubles. If I don't pass PID/GID, I can't operate on these files. Here is my
devcontainer.json
:I am there not able to create files in the directory where I want:
It is because remapping of the UID/GID happened:
If I disable the remapping via
updateRemoteUserUID: false
, I can't write into the workspace inside the Docker container (apart from the previously created/opt/dir
).What would solve this problem is using a build arguments (
build.args
) in thedevcontainer.json
. There exists abash
variableUID
:So I was hoping for a following to work:
But sadly, it is an empty variable and thus building the Docker for Remote Container fails:
My problem would be solved be either a new VS Code variable, that will hold a current user UID/GID, so I can just use
build.args
with"PUID": "${VS_CODE_NEW_VARIABLE_FOR_UID}"
.Or what am I doing wrong, that
localEnv:UID
is not working in the VS Code?When I try to use
localEnv:USER
, then it gets the right environment value (but of course it fails on the build, since it is the name of user, and not UID), so how can I access the UID?I have tried modyfing my
~/.bashrc
with something likeexport VS_CODE_WORKAROUND_UID=$(id --user)
. Then sourcing it and reloading the VS Code and I can see that it is in the environment:But
${localEnv:VS_CODE_WORKAROUND_UID}
is still empty.Thanks
Does this issue occur when you try this locally?: Yes/No
Does this issue occur when you try this locally and all extensions are disabled?: Yes/No
The text was updated successfully, but these errors were encountered: