Using containers
This page describes basic usage of the LOFAR containers. For more detailed information about Apptainer in general, see the Apptainer documentation.
Table of contents
Directories that need to be accessible should be bound to the container by passing
--bind <dir1>,<dir2>,<dir3>or-B <dir1>,<dir2>,<dir3>to eitherapptainer shellorapptainer exec. This directory binding is recursive.
Environment variables that need to be accessible inside the container should either be set after entering the container or set by using the
APPTAINERENV_prefix before entering the container. For example, definingAPPTAINERENV_MYVARwill defineMYVARinside the container.If you need to add entries to PATH, this can be done by defining
APPTAINERENV_PREPEND_PATHorAPPTAINERENV_APPEND_PATHto, respecitvely, prepend or append values toPATH.
Pay attention to environmental settings that get passed to the container. Mixing (too much of) the host environment with the container environment can result in unexpected behaviour. Especially
PYTHONPATHcan wreak havoc if inherited from the host system. In a worst case scenario--cleanenvor-ccan be used to clean the host environment before entering the container.
Interactive use
The containers can act as your normal shell for interactive data reduction. To do so, use
apptainer shell <container>
This will provide a Bash shell with the software and Python environment loaded.
Non-interactive use
Software can also be directly executed from the container. This is useful when interactive processing is not available or cumbersome, such as on clusters or for bulk processing. To directly execute something in the container, use
apptainer exec <container> <command> <arguments>
For example, compressing a Measurement Set with dysco using DP3 would be done as
apptainer exec <container> DP3 msin=input.ms msout=output.ms msout.storagemanager=dysco steps=[]
It is not restricted to individual commands. Pipelines or bash scripts that execute multiple commands can also be run this way.