singularity
singularity copied to clipboard
How to set env vars in containers via plugins
Version of Singularity:
3.2.1
Expected behavior
It is straightforward to write a plugin that sets new environment variable(s) within the container at runtime.
Actual behavior
@AdamSimpson has provided feedback indicating that it is not straightforward to provide this functionality through a plugin.
Either an easy way already exist, but it requires better documentation or we need to develop one it seems.
Attn: @mem, @bauerm97
I was able to hack around this by using an OCI spec generator to modify the OCI spec that's exposed from the plugins EngineConfig
instance. To set ENV_VAR
to VAL
you can currently do something like this from within the plugin:
generator := generate.Generator{Config: &cfg.OciConfig.Spec}
envString := VAL
generator.AddProcessEnv("ENV_VAR", envString)
Hello,
This is a templated response that is being sent out to all open issues. We are working hard on 'rebuilding' the Singularity community, and a major task on the agenda is finding out what issues are still outstanding.
Please consider the following:
- Is this issue a duplicate, or has it been fixed/implemented since being added?
- Is the issue still relevant to the current state of Singularity's functionality?
- Would you like to continue discussing this issue or feature request?
Thanks, Carter
This issue has been automatically marked as stale because it has not had activity in over 60 days. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.
@GodloveD Still getting this problem ? Have this been solved already ? If yes, what work around have you followed and applied ?
We're looking into the issue carefully, soon will bring to community and discuss ways to better solve as well address this. Thankyou for keeping the interest in the subject.
Looks like a Hack was already documented so this old Singularity repo issue is being closed. If this is still critical, please open issue under new Apptainer repo.