I know how to run a singularity:
singularity run /mn/sarpanitu/singularity/test/fenics-and-more.img
Is there a way to do a one line (or more) to run the previous command, and then in singularity run echo "hi there" ? (Of course, I will use something more complex than hi there in production). Once this is done, I want my singularity to still be well and alive for interactive use.
So something like the intent of:
singularity run /mn/sarpanitu/singularity/test/fenics-and-more.img -bash-command echo "hi there"
or
singularity run /mn/sarpanitu/singularity/test/fenics-and-more.img -run-script-at-startup script.sh
Use exec, for executing a command within container instead of run. Add the shell and the script as parameters.
singularity exec /mn/sarpanitu/singularity/test/fenics-and-more.img /bin/sh script.sh
Also, add the execution of parameter as a default runtime command in the runscript part.
%runscript
exec "$@"
This is very related to the following question: bash script to perform action in a singularity container it opens . Solution is posted there, basically using the -c option and spawning a bash console.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With