Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Edit runscript of singularity .sif container after building

Tags:

containers

hpc

I have build a singularity container and uploaded it to my HPC service.

Is there a way to change the runscript of the .sif file without rebuilding the whole container? I have a shell on the service.

From my understanding of singularity this should be possible but I cant find out how.

like image 652
Unlikus Avatar asked Oct 17 '25 11:10

Unlikus


2 Answers

You could create a new sif, based on the old sif and add the new runscript.

Bootstrap: localimage
From: my-old.sif
like image 90
test Avatar answered Oct 19 '25 08:10

test


You can convert a SIF file to a (writable) sandbox which is indeed a directory:

sudo singularity build --sandbox <SANDBOX> <CONTAINER>.sif

Then you can "get into" the sandbox and modify things there (note the --writable flag and the need for sudo):

sudo singularity shell --writable <SANDBOX>

Or you can edit <SANDBOX>/singularity or <SANDBOX>/environment as suggested by Quentin.

Additional goodies can be found in the <SANDBOX>/.singularity.d directory. Such as the Singularity file which is the recipe the container was built from.

Once you are happy with the changes you can convert the sandbox back to a (new) SIF file:

sudo singularity build <NEW_CONTAINER>.sif <SANDBOX>

like image 25
Laryx Decidua Avatar answered Oct 19 '25 10:10

Laryx Decidua



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!