Remote Building with OCI Registries

By Staff

Feb 7, 2024 | How To Guides

This blog post will demonstrate how to use a definition file in a remote build that references an Open Container Initiative (OCI) image stored in Singularity Enterprise and Singularity Container Services.
First, create an account in Singularity Container Service. To do this, please go to the registration page and click on the “Sign Up” button to obtain free access to the remote builder.
Secondly, using Crane, copy the Docker image over to Singularity Container Service:
$ singularity remote get-login-password | \
              crane auth login -u USERNAME --password-stdin \
2023/06/07 01:56:04 logged in via /home/USERNAME/.docker/config.json
$ crane cp \
Then, in the definition file you can reference that OCI image as follows, the %post instructions are for demonstration purposes only:
Bootstrap: docker 

  apt update -qq
  apt install -y --no-install-recommends \
      software-properties-common dirmngr wget
Then you can trigger a remote build either from the remote builder or from the command line:
$ singularity build --remote ubuntu.sif ubuntu.def
INFO:    Starting build...
INFO:    Setting maximum build duration to 20m0s
INFO:    Remote "" added.
INFO:    Access Token Verified!
INFO:    Token stored in /root/.singularity/remote.yaml
INFO:    Remote "" now in use.
INFO:    Starting build...
Getting image source signatures
Copying blob sha256:361237ddf3...18f0b3435
Copying config sha256:d710383bdc8e0a...394af54773632
Writing manifest to image destination
Storing signatures
2023/06/07 08:47:51  info unpack layer: sha256:361237dd...b47ccd30556a7ba97c218f0b3435
INFO:    Running post scriptlet
INFO:    Creating SIF file...
INFO:    Build complete: /tmp/image-1838580909
INFO:    Performing post-build operations
INFO:    Generating SBOM for /tmp/image-1838580909
INFO:    Adding SBOM to SIF
INFO:    Calculating SIF image checksum
INFO:    Uploading image to library...
WARNING: Skipping container verification
INFO:    Uploading 102181239 bytes
INFO:    Image uploaded successfully.
INFO:    Build complete: ubuntu.sif
As demonstrated, it is very easy to take a base image from an OCI registry and add more functions in a definition file and obtain a SIF file ready to run in an HPC scheduler.

Join Our Mailing List

Recent Posts

Related Posts

OCI Basics using Singularity Enterprise Registry

Overview Singularity Enterprise comes with a fully compliant Open Container Initiative (OCI) registry. The following is a collection of typical registry operations within your workflow. Assuming the Singularity Enterprise registry address is, please...

read more