0

I am trying to start a singularity container and then run a python script from within that container. The commands work individually if I run them outside, but as soon as I put them in a shell script and run the shell script, the python script does not get executed until I close the singularity environment. This is the script

#!/bin/bash
singularity run /home/___/singularity_containers/singularity_container.simg bash
python3 /home/___/__/__/src/hello_world.py

If I run this with ./my_script.sh it enters the singularity environment, but does not execute the python code until I manually "exit" the singularity environment. How would I chain the commands so that the python script gets executed from within the singularity environment?

1 Answers1

0

You may need to bind external directories so script and container can be executed altogether. The next link may help you: https://hpc.nih.gov/apps/singularity.html

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jun 28 '23 at 11:51
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/late-answers/1198205) – Destroy666 Jun 28 '23 at 12:41