bioinfo@ird.fr

Trainings 2019 – Admin HPC – module 2 – creation container – EN

Container creation

Description Create your own Singularity containers
Related-course materials HPC Administration Module2
Authors Ndomassi TANDO (ndomassi.tando@ird.fr)
Creation Date 24/09/2019
Last Modified Date 24/09/2019

Summary


Install dependencies

 $ sudo yum update -y && \
      sudo yum groupinstall -y 'Development Tools' && \
      sudo yum install -y \
      openssl-devel \
      libuuid-devel \
      libseccomp-devel \
      wget \
      squashfs-tools \
      git

Install The programming language Go:

Go to the Download Page and choose the archive go.1.12.5.linux-amd64.tar.gz

Launch the following commands:

# Download the archive
    wget https://dl.google.com/go/go1.12.5.linux-amd64.tar.gz
    # Extract the archive into /usr/local
    sudo tar -C /usr/local -xzvf go1.12.5.linux-amd64.tar.gz

Set up your environment for Go with the following commands:

# Create the GOPATH variable into .bashrc
    echo 'export GOPATH=${HOME}/go' >> ~/.bashrc
    # Set the PATH with Go
    echo 'export PATH=/usr/local/go/bin:${PATH}:${GOPATH}/bin' >> ~/.bashrc
    # Resource your environment to take the modifications into account
     source ~/.bashrc

For Singularity > v3.0.0, we also need to install dep for dependency resolution

go get -u github.com/golang/dep/

Download and install singularity from repo:

To ensure that the Singularity source code is downloaded to the appropriate directory use these commands.

go get -d github.com/sylabs/singularity

You will obtain a warning but it will still download Singularity source code to the appropriate directory within the $GOPATH

# move to the singularity folder
     cd ~/go/src/github.com/sylabs/singularity/ 
     # launch the mconfig command ( you can add the option --prefix=path to custom the installation directory)
     ./mconfig --prefix=/usr/local/singularity
     # Compile into the build directory
     make -C ./builddir
     # Install the binaries into /usr/local/singularity/bin by default as superuser
     sudo make -C ./builddir install

Type the following command to your .bashrc file to enable completion in singularity:

. /usr/local/etc/bash_completion.d/singularity
    # resource your .bashrc
    source ~/.bashrc

Modify Bind path in Singularity

bind path allows to mount host partitions into the container directly at startup.

Modify the file /usr/local/singularity/etc/singularity/singularity.conf

In BIND PATH part

Add the partitions you want to see in the container:

For example:

bind path = /opt
bind path = /scratch
bind path = /data

Activate the overlay with the line:

enable overlay = yes

Links


License

The resource material is licensed under the Creative Commons Attribution 4.0 International License (here).