This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Singularity file management

Hi,

Fed up with struggling with lib install/dependencies problems, I'm trying to setup procedures to work with Singularity. Though, I'm not sure I understand precisely how it works regarding files management (not data, programs). For example, I designed a very simple definition file that is just a "naked" Debian:

Bootstrap: library
From: debian

%post
apt-get update

I create a sandbox with this to add stuff:

sudo singularity build --sandbox Test/ naked_Debian.def

And I try to install stuff (STAR for example). But what I don't understand is that I managed to do it, removed the sandbox directory but I think there are still files that were created during the sandbox life (in /dev, /run, /root, etc.). For example, the STAR clone that I did is in /root. From what I understood, everything was in the container and should disappear if I remove the sandbox directory. Otherwise, I'm gonna leave a lot of mess with all the tests? And then I can't port the container from system to another.

If I create again the Test sandbox directory, then STAR is already there (I don't know where!).

Cheers, Mathieu

singularity container reproducibility

This is probably a question better suited to StackExchange.

I will leave it open, as there may be some nuances to certain bioinformatics software being containerised that I'm not aware of, but I don't expect getting an answer on Biostars will be the most efficient approach.

Okay thanks, I posted the question on SO. What do you prefer? I remove my question or provide the answer here if there is one?

You can leave it and post an answer here if you get one. It would be a good idea to mention that the question has been cross-posted in more than one community as a courtesy to both communities though.

2 answers

FYI, I had a good answer here on SO.

Cheers, Mathieu

I've been using Singularity for a few years now and never really found a use for "sandbox mode". My suggestion is to instead start by building an analogous Dockerfile, which allows you to docker run --rm -ti my_container bash into it and interactively install all your components. Then, copy/paste the installation commands you used into your Singularity definition file, and build with it.

The one "gotcha" you might want to avoid is by not using bootstrap: docker in your Singularity recipe, because sometimes the base image for the same OS release is actually different between e.g. debootstrap and docker. I am not familiar with bootstrap: library.

Log in to answer this question.