moi.jpg

Martin Souchal

Bonjour šŸ‘‹

I’m Cloud Architect & DevOps leader at INRAE. Find me on Github, Gitlab, Gitlab and Dockerhub.

Posts • Categories • Tags

CI/CD with Singularity, Gitlab CI and Singularity Registry

A singularity registry is a dockerhub-like interface for sharing containers. With the sregistry client you can push/pull singularity containers into a singularity registry (public or private).

The following tutorial use a docker image with sregistry and singularity 2.6 installed (sysmso/singularity-ci).

sregistry-cli is available here : https://singularityhub.github.io/sregistry-cli/

How to upload container to sregistry with Gitlab CI

Example of .gitlab-ci.yml to build and push a container named container.simg, based on a Singularity recipe file into a sregistry :

Tutorial : Singularity and Docker

How to use private Gitlab Registry with Singularity

With Singularity release 3.3, it is now possible to push and pull a Singularity container into an OCI registry like Docker or Azure Container Registry. It also works with Gitlab registry, which are basically Docker registry. This is a great news for CI/CD with Singularity and Gitlab !

Here is how to proceed with a private Docker GitLab registry:

NB: user is the username gitlab, passwd the associated password, container.sif is the image singularity and project the name of the Gitlab project.

TP : How to build a Singularity container

How to build a Singularity container

This recipe describes how to build an Ubuntu image using Singularity, with the latest Singularity 2 version (2.6). You can download Singularity and find some docs here : https://www.sylabs.io/docs/

All the files mentionned in this recipe are available in the following git repository : https://gitlab.in2p3.fr/souchal/tp-singularity

This recipe is for Linux only. You need superuser rights (sudo)

My first container

  • Singularity installation
  • Build images from scratch
  • Interact with images

Singularity installation

git clone https://github.com/singularityware/singularity.git
cd singularity
git fetch --all
git checkout 2.6.0
./autogen.sh
./configure --prefix=/usr/local
make
sudo make install

The –help option gives an overview of Singularity options and subcommands as follows: