-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
set default HOME env properly #341
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one comment :)
pkg/commands/run.go
Outdated
u = userObj.Username | ||
} | ||
|
||
return append(envs, fmt.Sprintf("%s=/home/%s", constants.HOME, u)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that if the UID is set instead of username, the value of $HOME defaults to root /
I tried it out with this Dockerfile:
FROM ubuntu
USER 1000
CMD echo $HOME
and ran it:
$ docker run test
/
that's what seems like is happening. We still ignore Dockerfile_test_user_run in the integration tests, which is they didn't catch it.
I couldn't find any documentation to verify this unfortunately, it just says that HOME is determined by USER here 😞
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I can verify that that is docker's behavior, silly as it is. Should we default to that? It seems like bad behavior since specifying username sets $HOME properly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm yah it doesn't really make sense, but I guess we should probably try to mimic Docker as much as we can since it seems like people are running into issues with it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any updates on this? I think copying Docker is probably the right thing to do by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, done.
Fixes #333