Simplified Geant4 usage with a Docker container derived from a Ubuntu 18.04 ROOT container. The image is hosted on DockerHub
Docker can be installed following the instructions on the Docker homepage. The Docker image can also be used very well to build a Singularity container from it. Tested on CentOS7 with Singularity 3.2 successfully with graphics support wihtout the need for passing further flags.
To run the container, simply call
docker run -it --rm --name geant4_container smflment/geant-4-docker:10.5.1 bash
Options:
-it
: Keep bash open after invoking--rm
: Delete container when stopping. Remove this option if you want to keep your container for more than one session--name geant4_container
: Name for your container.
To use the GUI, you need to pass X11 information. From Linux you can run the container using
docker run -it --rm --ipc=host --net=host \
-e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix \
-v "$HOME/.Xauthority:/root/.Xauthority:rw" \
--name geant4_container \
smflment/geant-4-docker:10.5.1 bash
A simple test can be performed using a simple example within the container:
cp -r $G4EXAMPLES/basic/B1 ./ && cd B1/ && mkdir build && cd build && cmake ../ && make && ./exampleB1
The bare image comes without examples and datasets. You will need to download them yourself in that case and provide them using a volume adding the option
-v path/to/unpacked/datasets:/usr/local/geant4/share/Geant4-10.5.1/data
- G4NDL.4.5
- G4EMLOW.7.7
- G4PhotonEvaporation.5.3
- G4RadioactiveDecay.5.3
- G4PARTICLEXS.1.1
- G4PII.1.3
- G4RealSurface.2.1.1
- G4SAIDDATA.2.0
- G4ABLA.3.1
- G4INCL.1.0
- G4ENSDFSTATE.2.2
Download shortcut:
wget https://cern.ch/geant4-data/datasets/G4NDL.4.5.tar.gz \
https://cern.ch/geant4-data/datasets/G4EMLOW.7.7.tar.gz \
https://cern.ch/geant4-data/datasets/G4PhotonEvaporation.5.3.tar.gz \
https://cern.ch/geant4-data/datasets/G4RadioactiveDecay.5.3.tar.gz \
https://cern.ch/geant4-data/datasets/G4PARTICLEXS.1.1.tar.gz \
https://cern.ch/geant4-data/datasets/G4PII.1.3.tar.gz \
https://cern.ch/geant4-data/datasets/G4RealSurface.2.1.1.tar.gz \
https://cern.ch/geant4-data/datasets/G4SAIDDATA.2.0.tar.gz \
https://cern.ch/geant4-data/datasets/G4ABLA.3.1.tar.gz \
https://cern.ch/geant4-data/datasets/G4INCL.1.0.tar.gz \
https://cern.ch/geant4-data/datasets/G4ENSDFSTATE.2.2.tar.gz