Skip to main content

Containers support

Users can run containers with enroot. Enroot uses the same underlying technologies as docker but without the isolation.

Download container image​

To get started, import a docker image from a repository. In the following example, we are downloading a docker tensorflow image from the docker repository.

[IS000G3@origami ~]$ srun --partition=student --mem=2G --cpus-per-task=4 enroot import docker://tensorflow/tensorflow:latest-gpu

In the current working directory, a .sqsh will be created. This is the image file which was downloaded from the previous command.

In our example, a tensorflow+tensorflow+latest-gpu.sqsh is created

[IS000G3@origami ~]$ ls -lrt tensorflow+tensorflow+latest-gpu.sqsh
-rw-r--r--. 1 IS000G3 IS000G3 5958070272 Dec 21 15:17 tensorflow+tensorflow+latest-gpu.sqsh

Create container on cluster​

Create a container from the .sqsh image. In our following example, we are creating a container named tensorflow from the tensorflow+tensorflow+latest-gpu.sqsh file

[IS000G3@origami ~]$ srun --partition=student --mem=2G --cpus-per-task=10 enroot create --name tensorflow "tensorflow+tensorflow+latest-gpu.sqsh"

When the command completes, check that the container has been created

[IS000G3@origami ~]$ enroot list
tensorflow
Tip

You may remove the .sqfs file after creating the container to conserve home directory space

Using the container​

With the container created, you may run it interactively with the srun command or submit it as a batch job using sbatch

srun example​

The following example starts the container and places you in a interactive bash shell environment

[IS000G3@origami ~]$ srun --pty --partition=tester --mem=8G --cpus-per-task=4 --gres=gpu:1 enroot start tensorflow bash

sbatch example​

The following example requests for a GPU resource from the scheulder to start a tensorflow container. It mounts the entire user home directory into the /tf directory on the container and executes the python code "echo.py"

#!/bin/bash

#SBATCH --ntasks=1
#SBATCH --time=00:30:00
#SBATCH --nodes=1
#SBATCH --mem=16GB
#SBATCH --cpus-per-task=4
#SBATCH --qos=studentqos
#SBATCH --partition=student
#SBATCH --gres=gpu:1
#SBATCH --job-name=containerJob

srun --pty --partition=student --mem=8G --cpus-per-task=4 --gres=gpu:1 enroot start --mount ~:/tf tensorflow python echo.py

Removing a container from your account​

To remove a container, execute the following command

[IS000G3@origami ~]$ enroot remove <name of container>