Docker Containers

The following new capabilities are available in v1.6.0 of Damaris

The Damaris Gitlab repository now has a Docker Registry hosting capability and pre-built Docker images will be available there, initially using Ubuntu 20 and CentOS 8 base images.

The Docker Dockerfiles used to build the containers are available from within the the Damaris repository at damaris/build/docker. There are a range of different Dockerfiles, each ending in the dependent library that the Damaris version is built to support. The default images support Damaris with HDF and OpenMPI, and all images include unit tests and a build of the relevant examples. The Damaris library is installed in a user accessible /home/docker/local directory, which should enable write enabled access via Singularity when used on systems without Docker. The Dockerfiles and/or images can be used as base images to build other software that uses Damaris.

To access the pre-built images, you need to log in to the container registry and pull the container.

1
2
3
4
5
$ [sudo] docker login registry.gitlab.inria.fr
# pull the desired version. They are tagged versions that indicates the base OS, the version of Damaris and (currently) Paraview dependencies)
$ [sudo] docker pull registry.gitlab.inria.fr/damaris/damaris:quay.io-centos-centos-stream8-pv580-damaris-master
# or 
$ [sudo] docker pull registry.gitlab.inria.fr/damaris/damaris:debian-10-pv591-damaris-master

The Dockerfile recipes used for the builds are available in the build/docker directory and can be used to build a docker image containing Damaris in the following way:

1
2
3
4
5
$ sudo TAG=v1.5.0 DOCKER_BUILDKIT=1 docker build -t \
            registry.gitlab.inria.fr/damaris/damaris-ubu20:${TAG} \
            --build-arg INPUT_damaris_ver=${TAG} \
            --build-arg INPUT_repo=damaris \
                -f ./Dockerfile.ubuntu20 .

You will notice two –build-args

  • INPUT_damaris_ver= should be set to a repository tag or specific branch.
  • INPUT_repo= can specify the public Damaris repository (=damaris) or another gitlab project of your choice.

The Dockerfiles ending with .paraview are used to build containers with Damaris and Paraview support.
If you plan to use Paraview, the client version of Paraview (used as the GUI) must match the exact version
used in the container. Set PV_VER to the appropriate value.

1
2
3
4
5
6
7
8
9
 export TAG=v1.5.0
 export PV_VER=v5.9.0
 export PVSHORT=$(echo $PV_VER | sed 's|\.||g'))
 sudo  DOCKER_BUILDKIT=1 docker build -t \
            registry.gitlab.inria.fr/damaris/damaris:${TAG} \
            --build-arg INPUT_damaris_ver=${TAG}-centos8-${PVSHORT} \
            --build-arg INPUT_repo=damaris \
            --build-arg INPUT_pv_ver=${PV_VER} \
                -f ./Dockerfile.centos8.paraview .

There is an extra –build-args in the above command to specify the ParaView version to install.

A couple of things to note:

  • Some builds of ParaView fail due to a CMake issue not finding Python. Be cautious of PV 5.8.X on Debian 11 and Ubuntu 21.
  • Dockerfiles that support VisIt are currently in development – they will be present in the Gitlab repository when they are available.

The Docker files are currently used by the Gitlab CI system, so should remain in this directory (build/docker) and not be modified without careful testing. They currently compile the HDF5 compatible version of Damaris. The Python capable version should also be implemented sometime.

To use the Docker image that has been pulled from the repository or built with the Dockerfile of choice, you can execute something like the following:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# Get a shell into the container
sudo docker run --rm -it registry.gitlab.inria.fr/damaris/damaris:<branch> /bin/bash
 
# Run unit tests:
<container prompt> cd /home/docker/local/examples
<container prompt> ctest
 
# run and example:
<container prompt> mpirun -np 4  /home/docker/local/examples/storage/3dmesh \ 
/home/docker/local/examples/storage/3dmesh.xml [-v] [-r]
 
# Should find HDF5 output
<container prompt> ls *.h5
<container prompt> h5dump *.h5

Extending the Docker images
The built Docker images from the Dockerfiles above (or pulled from the registry) can be used as base layers for other simulation software that uses Damaris. A Dockerfile can be created naming the image and tag of choice for its base layers and then the simulation code installed from there. An example Dockerfile might look like the following

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# syntax=docker/dockerfile:1
FROM registry.gitlab.inria.fr/damaris/damaris:latest-ubu20 AS simulation
SHELL ["/bin/bash", "-c"]
 
# install needed build tools (N.B. cmake is already installed in base image)
RUN apt-get update -y \
  && apt clean \
  && echo "debconf debconf/frontend select Noninteractive" | debconf-set-selections \
  && apt-get install -y --no-install-recommends \ 
    apt-utils \
    build-essential \
    gfortran \
    pkg-config \
    git-core \
  && apt-get clean \
  && rm -rf /var/lib/apt/lists/*
 
# Now download and compile the simulation software, 
# linking against Damaris (installed in /home/docker/local/lib)
...
 
CMD ["/path/to/sim" "arg1" "arg2"]

Once the Dockerfile has been written, save it, say as “Dockerfile.sim-ubu20” and build a container with the software using the docker build command:

1
2
$ sudo docker build -t simulation-ubu20 \
                -f ./Dockerfile.sim-ubu20 .

To manage images and containers of docker, you may take a look at  online documents of docker.

Comments are closed.