Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to build writable singularity container

I am trying to build a writable singularity container with the command sudo singularity build --writable my_container.img docker://image_name, but I get the error Error for command "build": unknown flag: --writable.

I decided to follow a guide from Singularity (here) to see if I could find my problem. I am using the command sudo singularity build --writable lolcow.img shub://GodloveD/lolcow, but I am getting the same error Error for command "build": unknown flag: --writable.

I am on singularity version 3.6.4.

Does anyone happen to know what might be going on?

like image 932
Josh Loecker Avatar asked May 06 '26 12:05

Josh Loecker


1 Answers

--writable is option for running. That is for building:

sudo singularity build lolcow.img shub://GodloveD/lolcow

For running:

singularity run --fakeroot --writable lolcow.img

You also need --fakeroot to write in root accessible places.

However, It is not persistent. As reminded by "Converting SIF file to temporary sandbox..." message. That is you can write during your session but after you done it is gone:

$ singularity shell -f --writable lolcow.img

INFO:    Converting SIF file to temporary sandbox...
WARNING: Skipping mount /etc/localtime [binds]: /etc/localtime doesn't exist in container
Singularity> echo test > /etc/banana
Singularity> cat /etc/banana
test
Singularity> exit
INFO:    Cleaning up image...

$ singularity shell -f --writable lolcow.img

INFO:    Converting SIF file to temporary sandbox...
WARNING: Skipping mount /etc/localtime [binds]: /etc/localtime doesn't exist in container
Singularity> cat /etc/banana
cat: /etc/banana: No such file or directory
Singularity>

For persistent writes for testing/developing purpose you can use --sandbox option, though you'll need to run it as root too:

$ sudo singularity build --sandbox lolcow.img shub://GodloveD/lolcow

$ sudo singularity shell --writable lolcow.img

WARNING: Skipping mount /etc/localtime [binds]: /etc/localtime doesn't exist in container
Singularity> echo test > /etc/banana
Singularity> cat /etc/banana
test
Singularity> exit

$ sudo singularity shell --writable lolcow.img
WARNING: Skipping mount /etc/localtime [binds]: /etc/localtime doesn't exist in container
Singularity> cat /etc/banana
test
Singularity> exit
like image 69
Nikolay Avatar answered May 11 '26 00:05

Nikolay



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!