====== Geant4 Docker Image Isolpharm_Ag ======
===== Create the Image =====
==== Prerequisites ====
* [[https://www.docker.com|Docker]]
* [[https://git-scm.com|Git]]
* [[https://www.geant4.org|Geant4 (10.3.X)]]
==== Procedure ====
Clone from GitHub the repository of the Geant4 code for the application and the docker image
git clone https://github.com/ebagli/G4_ISOL_RELEASE.git
git clone https://github.com/andreadotti/docker-geant4.git
Enter the directory ''applications'' in the ''docker-geant4'' cloned repository
cd docker-geant4/applications
Substitute the ''runme.sh'' file in the ''docker-geant4/applications'' with the ''runme.sh'' of the ''G4_ISOL_RELEASE'' cloned repository.
cp ../../G4_ISOL_RELEASE/runme.sh .
Build the binaries of the application
./build-binaries.sh [Geant4_data_abs_dir] [G4_ISOL_RELEASE_abs_dir] andreadotti/geant4-dev:10.3.p02
where the ''[Geant4_data_abs_dir]'' is the directory where the data downloaded from the [[https://www.geant4.org|Geant4 website]] is stored.
The ''[G4_ISOL_RELEASE_abs_dir]'' is the directory where the [[https://github.com/ebagli/G4_ISOL_RELEASE.git|G4_ISOL_RELEASE application]] is stored.
Build the image
./build-image.sh -y andreadotti/geant4:10.3.p02-data ebagli/isolpharm
Tag the image
docker tag ebagli/isolpharm ebagli/isolpharm:latest
Push on Docker repositories
docker push ebagli/isolpharm:latest
===== Use the Image =====
Pull the Docker image from the online repositories
docker pull ebagli/isolpharm
Run the Docker image
docker run -v [output_abs_dir_on_host]:/output:rw -v [macro_abs_dir_on_host]:/macros/ ebagli/isolpharm /runme.sh [macro_file_name] [--primaries]
where ''[output_abs_dir_on_host]'' is the directory where the output data will be stored and ''[macro_abs_dir_on_host]'' is the directory where the macros are stored. The ''[--primaries]'' flag is used to enable the generation of the primaries.
===== Close the Docker containers =====
List all the containers
docker ps -a
Stop all the running containers
docker stop $(docker ps -a -q)
Delete all the stopped containers
docker rm $(docker ps -a -q)