Docker and Singularity containers with a basic installation of the GERDA software.
- MaGe is checked out at
GERDAphaseII
branch - Repositories which need constant updates (like e.g. metadata repositories) are not included in the images. They can be included e.g. inside an externally mounted volume (see below)
- git branches are used to distiguish between software versions
g4.9.6
→ CLHEP_v2.1.3.1 and GEANT4_v9.6.p04g4.10.3
→ CLHEP_v2.3.4.4 and GEANT4_v10.3.p03
- Remeber to update
%applabels
sections inSingularityfile
s when updating submodules TODO: script
- Move source code from
/scif/src/
to/scif/<app>/src
in Singularity containers - Update all with the new MaGe tag
- Script to generate Singularity files with correct submodule versioning
- Find a place to store prebuilded Singularity images:
LNGS-cluster@/nfs/gerda5/var/gerda-simulations/
All the images of this repository can be found at https://baltig.infn.it/gerda/gerdasw-containers/container_registry. To download them you must be registered (ask luigi.pertoldi@pd.infn.it), then you can use the following syntax:
$ sudo docker login baltig.infn.it:4567
$ sudo docker pull baltig.infn.it:4567/gerda/gerdasw-containers/<image>:<tag>
Let's say you have pulled the gerdasw:g4.10.3
image, then a call to docker run gerdasw:g4.10.3
with no arguments spawns a zsh shell by default:
$ sudo docker run \
-i -t --rm \
-h gerda-sw \
gerdasw:g4.10.3
The -i
and -t
flags allow to start an interactive session inside a new tty (mandatory to spawn the shell). The --rm
flag removes the container after stopping it. Optional: -h gerdasw
sets the container's hostname to 'gerda-sw'.
Any other custom command can be injected inside the container, e.g.:
$ sudo docker run gerdasw:g4.10.3 MaGe
To mount a folder (/path/to/src
) inside the container (mount point: /path/to/dest
) run it with:
$ sudo docker run \
-v /path/to/src:/path/to/dest \
gerdasw:g4.10.3 <...>
NOTE: on some systems you could find high latency in accessing externally mounted volumes from within the container (see for example this issue). Consider using Docker volumes instead.
Important: to make the software fully work inside the container you must mount the following folder structure under /common
:
common/
└── sw-other/
│── gerdageometry/
│── gerda-metadata/
└── gerda-ana-sandbox/
where the gerdageometry
can be found in the MaGe source repo. The log in and check that MGGERDAGEOMETRY
, MGGENERATORDATA
and MU_CAL
are set and point to existing locations. You could use the common/
location to store files that you want to preserve (e.g. MaGe macro files or output).
EDIT: With the recent MaGe tag (g4.10.3/v2.0
here) now MGGERDAGEOMETRY
and MGGENERATORDATA
point to gerdageometry/
and generators/data/
inside the MaGe source direcotry provided within the container under /opt/src/MaGe/
, so there's no more need to manually provide gerda-ana-sandbox
and gerdageometry
.
Clone this repository with --recursive
(note: requires access to GERDA's private repositories at https://github.com/mppmu).
Prebuilded images including ROOT, CLHEP and GEANT4 can be found here. Build up the complete image with:
$ cd gerdasw-containers
$ sudo docker build --rm . -t gerdasw:<tag>
All the images of this repository are hosted at the LNGS cluster under /nfs/gerda5/var/gerda-simulations/
.
Compressed images can be build up with:
$ cd gerdasw-containers # no joke, do it
$ sudo singularity build gerdasw.sqsh Singularityfile
Singularity will perform the build in a hidden directory under /tmp
and then compress it in a squash-fs format to produce the gerdasw.sqsh
image, so make sure to have enough disk space. If not, you can first perform the build in another partition:
$ sudo singularity build --sandbox <custom/dir> Singularityfile
And compress the result later:
$ sudo singularity build gerdasw.sqsh <custom/dir>
Try singularity help gerdasw.sqsh
or singularity run gerdasw.sqsh
to start using the
container, for other useful commands (e.g. those reported above for Docker) refer to the Singularity docs
or type singularity help
.
You can get informations upon about software included within the container by typing
$ singularity inspect --app <app-name> gerdasw.sqsh
Or specific help with
$ singularity help --app <app-name> gerdasw.sqsh
Important: mount the appriopriate folder structure under /common
to make the software inside the container fully functional (see --bind
flag). See the Docker section for details.
Singularity tips:
- Remember that your
$HOME
directory is mounted by default onto your containers, configuration dotfiles such as.bashrc
could be loaded and override environment variables inside the container. The--cleanenv
flag is your friend.
Make sure you have XQuartz installed and running. First get your IP address:
$ ip=$(ifconfig en0 | grep inet | awk '$1=="inet" {print $2}')
Then add your IP adress to the list allowed to make connections to the X server using xhost
:
$ xhost +$ip
Finally run the container setting the correct DISPLAY
variable, for example to launch interface
run:
$ docker run -e DISPLAY=$ip:0 gerda-sw interface
N.B.: the xhost +$ip
instruction grants access to the X server for the specified ip
address. This could expose your system to security holes if, for example, your IP address gets renewed or you switch network and forget to remove the old IP from the xhost
list. Take care of your xhost
list by cleaning it from untrusted IPs (use xhost -[name]
)!
Take a look to the Wiki here.
The above script should work, test needed.
Use the Dockerfile_decay0
to build up a Docker container with cernlib and decay0:
$ sudo docker build -f Dockerfile_decay0 . -t decay0
Then run it with
$ sudo docker run --rm decay0
N.B. write the output file in an external mounted volume!