Skip to content

Charliecloud

Charliecloud uses user namespaces to run containers with no priviledged operations (like default Singularity) or daemons (like Docker).

Charliecloud also has basic functionality to create Docker containers, using Docker under the hood - which means that creating containers requires Docker to be installed.

Charliecloud setup

Charliecloud is installed by CHPC and available by loading its module, module load charliecloud.

In order to run Docker containters, Charliecloud requires to get the Docker container from the local Docker repository into an archive file which can be moved to a different location, extracted and run.

Running Docker containers

Assuming that we have Docker installed and have a local Docker container repository with a container named hello, we first archive this container, then extract it and run:

ch-docker2tar hello /var/tmp
ch-tar2dir /var/tmp/hello.tar.gz /var/tmp
ch-run -b /uufs:/uufs -b /scratch:/scratch /var/tmp/hello -- bash

The first command, ch-docker2tar,  creates an archive hello.tar,gz, in directory /var/tmp, the second command extracts this archive, and the third command runs it. We are bind-mounting CHPC file servers with the -b option. Command to run in the container is separated from the launch command by -- ; in this case we are starting the bash shell.

If we were to run the container on another machine, like CHPC clusters, we would copy the hello.tar,gz archive to this machine, untar with ch-tar2dir, and run with ch-run.

We have tested Charliecloud with MPI and Infiniband as well, with some information provided at our GitHub page.

Creating Docker Containers

Charliecloud requires presence of Docker and root or sudo priviledges to build a container. We don't provide this capability on CHPC clusters, however, we have a special machine for this purpose. Please, contact us for details.

We can use the ch-build command to build container called hello based on Dockerfile in certain directory as:

sudo ch-build -t hello /path-to-directory-with-Dockerfile

Since Docker needs to be installed on a system that can build the containers, we can use all Docker commands, e.g. to query what containers are available in our local directory:

sudo docker images

 

Last Updated: 6/10/21