This image has ROOT, Geant4 and Garfield++ installed. This repository hosts the Dockerfile as well as the Docker image as a GitHub Package.
You don't need to build the image yourself since it is available as a container package.
To use the latest version:
docker run -it ghcr.io/lobis/root-geant4-garfield:latest
There are other tags available here, which provide different combinations of C++ Standard / ROOT / Geant4 / Garfield versions. For example, the tag built with C++17, ROOT v6-25-01, Geant4 v11.0.0 and Garfield 4.0 is available as:
docker pull ghcr.io/lobis/root-geant4-garfield:cxx17_ROOT-v6-25-01_Geant4-v11.0.0_Garfield-4.0
ROOT, Geant4 and Garfield expects the user to load the required environment variables via the corresponding initialization scripts (such as source $ROOTSYS/bin/thisroot.sh
). These lines are usually added to the .bashrc
file.
In this image to load initialization scripts for ROOT, Geant4 and Garfield it is enough to input source docker-entrypoint.sh
, which will load a script in /usr/local/bin/docker-entrypoint.sh
. This is also appended to the .bashrc
so that it loads automatically.
However when you are running a non interactive shell you may get an error. This is usually solved by doing source docker-entrypoint.sh
manually.
If you want to build the image you need to pass the different versions as arguments:
CMAKE_CXX_STANDARD=17
ROOT_VERSION=v6-25-01
GEANT4_VERSION=v11.0.0
GARFIELD_VERSION=4.0
docker build --build-arg CMAKE_CXX_STANDARD=$CMAKE_CXX_STANDARD --build-arg ROOT_VERSION=$ROOT_VERSION --build-arg GEANT4_VERSION=$GEANT4_VERSION -t lobis/root-geant4-garfieldpp:cpp${CMAKE_CXX_STANDARD}_ROOT-${ROOT_VERSION}_Geant4-${GEANT4_VERSION}_Garfield-${GARFIELD_VERSION} .