The documented method to build a Singularity container image requires using sudo privilege. In this 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:
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 makes significant changes. The following are the steps to do this, assuming you are on a SLAC CentOS 7 public login node (centos7.slac.stanford.edu), your current directory is /tmp, and you want to build a CentOS based Singularity container image:
singularity pull docker://centos:centos7.7.1908
singularity sif list /tmp/centos_centos7.7.1908.sif"
command. The squashfs image we need is usually 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
/sbin/unsquashfs -no-xattrs /tmp/centos_centos7.7.1908.sqsh
cd /tmp/squashfs-root; find usr bin lib* etc root var -type d -exec chmod u+w {} \;
def checkRootUID(base):
"""Verify that the program is being run by the root user.
:param base: a :class:`yum.Yumbase` object.
:raises: :class:`cli.CliError`
"""
# if base.conf.uid != 0:
# base.logger.critical(_('You need to be root to perform this command.'))
# raise cli.CliError
singularity shell /tmp/squashfs-root
singularity exec -w --no-home /tmp/squashfs-root yum install git
cd /tmp/squashfs-root; /sbin/mksquashfs . /tmp/my-container.img
singularity shell /tmp/my-container.img
Note that this image can also be used by Shifter at NERSC. But since this method doesn't follow NERSC's normal procedure to load Shifter image, you need to ask NERSC to load the image to their image pool manually.
You may also want to use visual panels to communicate related information, tips or things users need to be aware of. |
Related articles appear here based on the labels you select. Click to edit the macro and add or change labels.
|