Skip to content
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

Merged
merged 7 commits into from
Sep 27, 2018

Conversation

sharifelgamal
Copy link
Contributor

Fixes #333

Copy link
Collaborator

@priyawadhwa priyawadhwa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one comment :)

u = userObj.Username
}

return append(envs, fmt.Sprintf("%s=/home/%s", constants.HOME, u))
Copy link
Collaborator

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 😞

Copy link
Contributor Author

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.

Copy link
Collaborator

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.

Copy link
Collaborator

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, done.

@dlorenc dlorenc merged commit 49184c2 into GoogleContainerTools:master Sep 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants