This repository provides a ready-to-use Docker setup for running Geant4 with Qt and OpenGL GUI support on Linux systems. It builds Geant4 from source and runs the exampleB1 application inside the container.
- Geant4 11.2.1 built from source
- Qt5 and OpenGL support for full GUI visualization
- Includes all Geant4 datasets (via
-DGEANT4_INSTALL_DATA=ON) - Automatically builds and launches exampleB1
- Persists your simulation data via Docker volumes
- Minimal setup — no need to install Geant4 manually
- Linux (Ubuntu, Fedora, Arch, etc.)
- Docker installed
- X11 GUI working on your system (most Linux desktops support this)
Make sure your user is in the Docker group:
sudo usermod -aG docker $USER
newgrp dockerAllow Docker GUI apps to access your display:
xhost +local:root- Clone the repository:
git clone https://github.com/evagena/geant4-linux-docker.git
cd geant4-linux-docker- Run the script:
chmod +x run_geant4_linux.sh
./run_geant4_linux.shThis will:
- Build the Docker image (if needed)
- Download and compile Geant4
- Build exampleB1
- Launch the GUI
Dockerfile— Defines the full build environment and Geant4 installationrun_geant4_linux.sh— Builds the Docker image and runs exampleB1 in an interactive GUI container
- The container uses a persistent Docker volume called
geant4datato store files in/home/geant4user - You can modify the code inside the container and re-run the build to test changes
You’ll see the OpenGL visualization of the exampleB1 geometry, and can interact with it using Geant4 UI commands.
Eleni Vagena
This setup was created for teaching and research purposes in Geant4-based simulation.