Skip to content

How to get the name and uid of the user in %post section who started the build command? #2577

Closed Answered by dtrudg
Heng-Zhou asked this question in Q&A
Discussion options

You must be logged in to vote

There isn't an easy way to do this, because any environment related to the user, that might have been retained across sudo, is cleared when the %post is run.

You could use templating, and --build-args to pass the value in - see https://docs.sylabs.io/guides/latest/user-guide/definition_files.html#templating-how-to-pass-values-into-definition-files

Generally, using the username of the user who ran sudo should be avoided wherever possible in a container build, so that the container isn't inadvertently made specific to an individual user.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by Heng-Zhou
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants