-
I know we need to be root to build a Singularity container. But for some reason I need the name of the user and its uid in %post section who started the build command of the container. I tried |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
There isn't an easy way to do this, because any environment related to the user, that might have been retained across You could use templating, and Generally, using the username of the user who ran |
Beta Was this translation helpful? Give feedback.
-
Thank you. |
Beta Was this translation helpful? Give feedback.
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-filesGenerally, 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.