While Singularity doesn’t have a local image repository in the same way as Docker, it does cache downloaded image files. We will see in the next chapters that images are simply
.sif files stored on your local disk.
If you delete a local
.sif image that you have pulled from a remote image repository and then pull it again, if the image is unchanged from the version you previously pulled, you will be given a copy of the image file from your local cache rather than the image being downloaded again from the remote source. This removes unnecessary network transfers and is particularly useful for large images which may take some time to transfer over the network.
By default, Singularity uses
$HOME/.singularity/cache as the location for the cache.
This will not work on the VSC.
You can change the location of the cache by setting the
$APPTAINER_CACHEDIR environment variable to the cache location you want to use. Please set the variable $APPTAINER_CACHEDIR to $VSC_SCRATCH.
Since on the VSC HPC from UGent, some additional retrictions apply, we recommend to set this environment variable:
How do we know what is stored in the local cache? We can find out using the
singularity cache command
singularity cache list -v
This provides us with some more useful information about the actual images stored in the cache. In the
TYPE column we can see that an image type could be
shub because it’s a
SIF image that has been pulled from Singularity Hub.
We can remove images from the cache using the
singularity cache clean command. Running the command without any options will display a warning and ask you to confirm that you want to remove everything from your cache.
You can also remove specific images or all images of a particular type. Look at the output of
singularity cache clean --help for more information.