Containers are a useful way to take software produced on one system and make it portably run on another. A container image contains, not only the application you wish to run, but also most of the operating system is was created on - everything apart from the kernel.
The most popular container system is called Docker, which is aimed at use on laptops and desktops. Unfortunately, Docker is unsuitable on a machine like Hamilton, but we instead provide a compatible system called Singularity.
As an example, this is how to download and run the ubuntu image from Docker Hub on one of Hamilton's login nodes:
$ module load singularity
$ singularity build ubuntu_latest.simg docker://ubuntu:latest ... skip some output ... INFO: Creating SIF file... INFO: Build complete: ubuntu_latest.simg
$ singularity shell ./ubuntu_latest.simg Singularity> cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=20.04 DISTRIB_CODENAME=focal DISTRIB_DESCRIPTION="Ubuntu 20.04.2 LTS" Singularity>
Hamilton's compute nodes unfortunately do not currently have access to Docker Hub to download images. Once you have downloaded an image to a file on one of the login nodes, you will be able to run the container in a job script.
Example job script my_container_job.sh, to run the copy of bash within the cached Ubuntu image, using a single CPU core:
#!/bin/bash # Request resources: #SBATCH -n 1 # 1 CPU core #SBATCH --mem=1G # 1 GB RAM #SBATCH --time=6:0:0 # 6 hours (hours:minutes:seconds) # Run on the queue for serial ("sequential") work # (job will share node with other jobs) #SBATCH -p seq7.q # Make singularity available: module load singularity # Commands to be run: singularity run ./ubuntu_latest.simg /bin/bash -c "echo hello"
Submit it to the queue with the command: sbatch my_continer_job.sh