In this system, it is possible to set up a container-based program execution environment using Singularity. This section describes how to prepare the container image, customize the container, and build it.
 

Preparing the container image

    This section explains how to obtain a container image. Container images can be obtained from the local registry in SQUID (from the HPDA frontend only) or from a public registry on the Internet. You can also create your own container images and upload them to SQUID.
     
    When using the work area, be sure to execute the newgrp command before executing.

    download from the local registry

      Download the singularity container image from the local registry and create a sandbox. This operation is available only in the HPDA frontend. As an example, to retrieve the container image named test registered in the local registry/master_image, navigate to the directory where you want to create the sandbox and execute the following command.

      If the container image is successfully downloaded, a sandbox (test in the above example) will be created in the current directory.
       

    download from Singularity Library

      Download the singularity container image from the singularity library and create a sandbox.
      For example, to get the centos container image from the singularity library, navigate to the directory where you want to create the sandbox, and execute the following command.

      If the container image is successfully downloaded, a sandbox (centos in the above example) will be created in the current directory.
       

    download from Docker Hub

      Download the docker container image from Docker Hub and create a singularity sandbox.
      For example, to get a centos container image from Docker Hub, navigate to the directory where you want to create the sandbox, and execute the following command.

      If the container image is successfully downloaded, a sandbox (centos in the above example) will be created in the current directory.

     

Customizing and Building Container Images

    This section describes how to customize and build container images. there are two ways to build container images with SQUID: directly customize and build the sandbox, or write the customization in a def file and customize it at build time.
     

    Direct customization of the sandbox

      This section explains how to customize and build the sandbox directly. First, acquire the base container image you want to customize, and create a sandbox beforehand. Next, launch the sandbox as a container. As an example, to customize a sandbox called test, execute the following command.
      After the container is successfully started, you will see the Singularity prompt. From the above prompt, you can add packages by dnf, pip, etc. (The commands used to manipulate the packages will vary depending on the OS distribution stored in the container.) After the customization of the container image is completed, stop the container with the exit command.
      The next step is to build the container image and generate the sif file. As an example, to build a sandbox called test and create test.sif, execute the following command
      If the build is successful, a sif file will be created in the current directory.
       

    How to describe the customization in the def file

      This section explains how to write customization contents in a def file and customize it at build time. First, create a def file to be used for building.
      As an example, if we want to customize the test registered in the local registry as the base container image, the def file will look like the following

      Def file summary *Please refer to the singularity manual for details.
      Bootstrap, From Describe the type and location of the base image.
      %file Describe the file you want to copy from the host OS to the container.
      %post Describe the command for customization.
      %runscript Describe the process to be executed automatically when the container starts.

      After the def file creation is complete, build the container image and generate the sif file. As an example, to build using a def file named test.def and create test.sif, execute the following command

      If the build is successful, a sif file will be created in the current directory.