You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

The documented method to build a Singularity container image requires using sudo privilege. In the how-to document, we outline how to work with this constraint. Obviously if you have sudo somewhere that you can use to build a Singularity container image, your problem is solved. For those who don't, here are some of the options:

  1. Install an Oracle Virtual Box on your desktop or laptop. You can them install your own Linux virtual machine with the Singularity rpm, giving yourself root/sudo privilege on that VM. This will allows you to build an image. The solution works for both Windows, Mac and Linux desktop/laptop.
  2. Similarly, one can install Docker on your desktop or laptop. The install / pull a Linux Docker container and install Singularity rpm in the container. The rest is the same as above.
  3. Build what you need in a Docker image and upload to Docker Hub, and on a SLAC Linux host, use command "singularity pull your_docker_image" to convert and save it as a Singularity image.

If you want to do none of the above, you have an option to build a Singularity container image without root on a SLAC CentOS 7 machine. This method is a bit of hacking so it may not work in the future when Singularity make significant changes. The follows are the steps to do this, assuming you are on a SLAC CentOS 7 public login node, you current directory is /tmp, and you want to build a CentOS based Singularity container image:

  • Download and save a basic CentOS image from Docker: "singularity pull docker://centos:centos7.7.1908". This command will save a file /tmp/centos_centos7.7.1908.sif to /tmp.
  • Extract the squashfs image from the saved .sif file. A .sif has several objects inside, which you can exam by using "singularity sif list /tmp/centos_centos7.7.1908.sif" command. The squashffs image we need is the 3rd object. Extract and save it with command "singularity sif dump 3 /tmp/centos_centos7.7.1908.sif > /tmp/centos_centos7.7.1908.sqsh"
  • Unpack the files from the squashfs image: "/bin/unsquashfs noxattrs /tmp/centos_centos7.7.1908.sqsh"

 

 

Step-by-step guide

 

  • No labels