Differences from Docker

Before we use Singularity, we must understand that it works differently from Docker in very subtle ways:

  1. Images are files

  2. Images are read-only

  3. Singularity automatically bind-mounts your home directory

1. Images are files

Singularity can manage images itself so you never have to see where or how they're installed. However, images in Singularity can also be created as a SIF file that you manage just like any other file.

Since Singularity uses SIF files for images, Docker images will need to be converted to SIF. Thankfully, this feature is built into Singularity and will be invoked automatically when we run a Docker image in Singularity.

Managing SIF files ourselves can be useful for having one single image shared between an entire lab, instead of each lab member downloading their own image for the exact same tools.

2. Images are read-only

Just like Docker images, SIF files contain their own filesystem with the environment needed to run whatever program or programs are packaged in it. However, whereas Docker's filesystem lets you make temporary changes to this filesystem, the Singularity image's filesystem is read-only. Therefore, you won't be able to create or delete any files inside the image when you start an interactive session in it.

Images being read-only sometimes make running images made for Docker cumbersome, as we will see later.

3. Singularity automatically bind-mounts your home directory

When you enter a Singularity image, Singularity will automatically bind mount your home directory to the home directory inside the image. Therefore, everything inside the Singularity home directory will be write-able. You'll be able to see the tools available in the Singularity image to do work on files in your own home directory.

Last updated