Skip to content

Creating the Singularity Container

Katie mason edited this page Mar 29, 2021 · 1 revision

Creating the singularity container

Setup singularity on meitner and get the build instructions for the container

This example is meitner, but the same steps should work on your local computer with singularity version 2 (the version used on the tufts grid) installed.

  • make a working directory to build a new container. We provide an example below, but you make whatever directory you want. (doesn't have to be in the same directory as the setup script for example.)

     mkdir containers
    
  • go into the directory and clone the github repository that contains the build instructions for the container.

    cd containers
    git clone https://github.com/larbys/singularity-xrootd
    
  • source the setup script

    cd singularity-xrootd
    source setup_singularity2.sh
    

building the container

The main readme for the repo has the general instructions. We provide instructions here as well specific to the meitner machine and for the Tufts group.

Note, before actually building the container, we have to download some security files from Fermilab and put them in a folder in the /tmp directory. (We have to put the files on /tmp in order for the singularity build instructions to be able to find them.

  • make a personal folder on /tmp. (We use the value of the USER environment variable in the example command below.)

    mkdir /tmp/$USER
    
  • get your login credentials from fermilab. Use your Fermilab account name, marked here as fnal-name.

    kinit fnal-name@FNAL.GOV
    
  • we need the login credentials, because we need to transfer certificates from fermilab. We do that by

    scp -r fnal-name@uboonegpvm04.fnal.gov:/etc/grid-security /tmp/$USER
    scp fnal-name@uboonegpvm04.fnal.gov:/etc/vomses /tmp/$USER
    scp fnal-name@uboonegpvm04.fnal.gov:/etc/krb5.conf /tmp/$USER/.
    
  • Edit the container build file, Singularity, to copy the certificates from your tmp directory. Set the USER to your username (on meitner). The following line needs to be changed

    export USER=your-username
    
  • finally, build the container. In the example below, xfer_xrootd.img, is used as an example, you can use whatever you like. Note that the environment variable, SINGULARITY_BIN, was defined by the setup_singularity2.sh script.

    sudo -E $SINGULARITY_BIN build xfer_xrootd.img Singularity
    
  • copy xfer_xrootd.img to the directory on the tufts cluster you created previously once it finishes. This may take a few minutes.

Clone this wiki locally