Error using --writable option

1,130 views
Skip to first unread message

Jeffrey Layton

unread,
May 2, 2020, 8:07:34 AM5/2/20
to singu...@lbl.gov
Good morning,

I have a Singularity image that I created from a Docker image. I then tried to shell into the container using the --writable option and got an error:

$ singularity shell --writable cuda_10_1-base-ubuntu18_04.simg
FATAL:   no SIF writable overlay partition found in /home/laytonjb/NVIDIA/CONTAINER-4/cuda_10_1-base-ubuntu18_04.sing

I was reading a it and found a comment from April 2019 that you need an image with ext3 or a sandbox image. Is the source of the error because it's using squashfs?

What I want to accomplish is shelling into an existing container, install some tools, and then save that container. How can I do this with Singularity?

TIA,

Jeff


Chris Wood

unread,
May 2, 2020, 8:41:31 AM5/2/20
to singu...@lbl.gov
Hi Jeff,

yes - singularity containers are immutable by default. The --sandbox option allows you to create a writable container without using an ext3 filestore. I've not tried this directly from a docker container, but perhaps this will work:

sudo singularity build --sandbox mycontainer <recipe> # n.b. recipe could be a def file or a docker:// uri

# this generates a mycontainer/ directory

sudo singularity shell -w mycontainer
<...install tools..., exit from shell>

sudo singularity build mycontainer.sif mycontainer

note that in this form, the final build of the immutable mycontainer.sif is not directly reproducible from a single recipe, which is one of the advantages of Singularity.

Chris  

--
You received this message because you are subscribed to the Google Groups "singularity" group.
To unsubscribe from this group and stop receiving emails from it, send an email to singularity...@lbl.gov.
To view this discussion on the web visit https://groups.google.com/a/lbl.gov/d/msgid/singularity/CAJfzO5T12YP9OLAnQxkHancmeEa%2B2JCper4vjSeHSN3_Uy32aQ%40mail.gmail.com.

Jeffrey Layton

unread,
May 2, 2020, 8:56:19 AM5/2/20
to singu...@lbl.gov
On Sat, May 2, 2020 at 12:41 PM Chris Wood <c.c....@gmail.com> wrote:
Hi Jeff,

yes - singularity containers are immutable by default.

[Jeff] Yeah - I'm kicking myself for not thinking of this earlier. squashfs is read-only so it makes sense that they are immutable.

The --sandbox option allows you to create a writable container without using an ext3 filestore. I've not tried this directly from a docker container, but perhaps this will work:

sudo singularity build --sandbox mycontainer <recipe> # n.b. recipe could be a def file or a docker:// uri

# this generates a mycontainer/ directory

sudo singularity shell -w mycontainer
<...install tools..., exit from shell>

sudo singularity build mycontainer.sif mycontainer

[Jeff]  I'll test out this process. I'm assuming that once the "final" .sif container is created you can't go back to a sandbox to extend it.

I understand and appreciate the overall approach of making the containers read-only. I've run into situations where people want to take an existing container, where they don't have the original definition file, and software to it (this happens much more often than I thought). I can make this happen in Docker with a few extra commands, but I'm thinking this is impossible in Singularity. Not a good or bad thing - just a design choice.

I suppose you could put the image definition file in the Singularity container so if someone wanted to update the definition file and add something, you could. Or in my case, I use HPCCM so I could embed the HPCCM recipe in the image.

Thanks!

Jeff


note that in this form, the final build of the immutable mycontainer.sif is not directly reproducible from a single recipe, which is one of the advantages of Singularity.

Chris  

On Sat, 2 May 2020 at 13:07, Jeffrey Layton <layt...@gmail.com> wrote:
Good morning,

I have a Singularity image that I created from a Docker image. I then tried to shell into the container using the --writable option and got an error:

$ singularity shell --writable cuda_10_1-base-ubuntu18_04.simg
FATAL:   no SIF writable overlay partition found in /home/laytonjb/NVIDIA/CONTAINER-4/cuda_10_1-base-ubuntu18_04.sing

I was reading a it and found a comment from April 2019 that you need an image with ext3 or a sandbox image. Is the source of the error because it's using squashfs?

What I want to accomplish is shelling into an existing container, install some tools, and then save that container. How can I do this with Singularity?

TIA,

Jeff


--
You received this message because you are subscribed to the Google Groups "singularity" group.
To unsubscribe from this group and stop receiving emails from it, send an email to singularity...@lbl.gov.
To view this discussion on the web visit https://groups.google.com/a/lbl.gov/d/msgid/singularity/CAJfzO5T12YP9OLAnQxkHancmeEa%2B2JCper4vjSeHSN3_Uy32aQ%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "singularity" group.
To unsubscribe from this group and stop receiving emails from it, send an email to singularity...@lbl.gov.

Jason Stover

unread,
May 2, 2020, 9:04:07 AM5/2/20
to singu...@lbl.gov
Hi Jeff,

> I'm assuming that once the "final" .sif container is created you
can't go back to a sandbox to extend it.

You should be able to do:

singularity build --sandbox myimage.sif sandboxdir/

I _think_ you can do this as a non-root user as I'm pretty sure it's
using unsquashfs now instead of mounting the disk to a loopback dev
and copying.

> but I'm thinking this is impossible in Singularity.

In singularity, the definition used to build the image should be
located at: /.singularity.d/Singularity

This may not be 100% as you may not have the entire chain used to
build an image... but should give you a starting point.

-J

Jason Stover

unread,
May 2, 2020, 9:07:23 AM5/2/20
to singu...@lbl.gov
Ugh... I reversed the CLI options. It should be:

singularity build --sandbox sandboxdir/ myimage.sif

So.... singularity build [opt] [dst] [src] .... Not [src] [dst] ...
[dst] [src] ... [dst] [src] ...

-J

Chris Wood

unread,
May 2, 2020, 9:07:54 AM5/2/20
to singu...@lbl.gov
Hi Jeff,

An immutable container can't be extended directly, but there are 2 options:

singularity build --sandbox mywritableimage mycontainer.sif 

The definition file used to generate a container:

singularity inspect -d mycontainer.sif

Chris

Reply all
Reply to author
Forward
0 new messages