Athena on Docker containers¶
Generic Docker images for HEP software development¶
An example docker image is available that allows you to access ATLAS software over a local installation of CVMFS. To download the image do:
docker pull atlas/atlas_external_cvmfs
docker run -i -t -v /cvmfs:/cvmfs -v $HOME:$HOME atlas/atlas_external_cvmfs
docker run which are specific to these platforms.
Once the container is running, you will be presented with a prompt where you can setup atlas software as usual:
-bash-4.1$ setupATLAS
-bash-4.1$ asetup main,latest,Athena
Using Athena/24.0.6 [cmake] with platform x86_64-centos7-gcc11-opt
at /cvmfs/atlas-nightlies.cern.ch/repo/sw/main/2023-07-04T2101
````
You can now start a ROOT session or run a test job in the container:
```sh
mkdir run && cd run
Reco_tf.py --AMI q449 --conditionsTag CONDBR2-BLKPA-2022-17 --outputESDFile myESD
You can checkout Athena code from Git and compile it in the docker container. Clone the Athena git repository via https:
git clone https://[YOUR_USER_NAME]@gitlab.cern.ch/[YOUR_USER_NAME]/athena.git
kinit yourlxplususername@CERN.CH
git clone https://:@gitlab.cern.ch:8443/yourlxplususername/athena.git
Full Athena releases in Docker images¶
Docker images with a complete ATLAS offline installation can be readily produced
using a Dockerfile, which constitutes a set of sequential instructions for the
docker build command. An example Dockerfile to build a full Athena release can
be found in the docker git repository available at
gitlab.cern.ch/atlas-sit/docker. To
build the image follow the steps outlined below:
- Clone the docker repository
git clone https://:@gitlab.cern.ch:8443/atlas-sit/docker.git -
Move to the sub-directory named
slc6-athenaand build the image of an official release:The period at the end instructsdocker build -t athena:21.0.38 --build-arg RELEASE=21.0.38 .docker buildto use the Dockerfile found in that sub-directory. This specific Dockerfile installs an Athena release. Alternatively, a nightly release can be installed with the following command:The specific nightly for a given release number is set with thedocker build -t athena:21.0.39_2017-10-01T2151 --build-arg RELEASE=21.0.39 --build-arg TIMESTAMP=2017-10-01T2151 .TIMESTAMPoption. -
Run the image
Refer to the Mac or Ubuntu setup sections for arguments todocker run -i -t -v /cvmfs:/cvmfs -v $HOME:$HOME athena:21.0.38docker runwhich are specific to these platforms. For interactive processes (like a shell), you must use-i -ttogether in order to allocate a TTY for the container process.-i -tis often written-it. To automatically remove the container after you exit, use the extra option--rm.
When installing the main branch of Athena, it may be necessary to patch the
base installation for large RPMs. If this becomes necessary, you would need to
add the following commands (with the appropriate syntax) to the Dockerfile:
wget http://atlas-software-dist-eos.web.cern.ch/atlas-software-dist-eos/RPMs/rpm/4.8.0_patch/rpm-libs-4.8.0-55.slc6.UNSUPPORTED.x86_64.rpm
rpm2cpio rpm-libs-4.8.0-55.slc6.UNSUPPORTED.x86_64.rpm | cpio -idmv
export LD_LIBRARY_PATH=$PWD/usr/lib64:$LD_LIBRARY_PATH
Useful Docker commands¶
Configure a container for remote file access¶
If you have your grid credentials in a sub directory of your local home area, add the following additional option to the parameters of docker run:
-v $HOME/.globus:/home/atlas/.globus
lsetup rucio set the RUCIO_ACCOUNT to the user
associated with the credentials.
Additional shells¶
To open additional shells of a running container use the docker exec command:
docker exec -i -t <CONTAINER ID> /bin/bash
CONTAINER ID is the container ID of the docker machine. This
hash is typically displayed as the hostname in the shell; however, if it is not
visible, type:
hostname
docker ps
CONTAINER
ID.
Save a Docker image¶
You can save a docker image locally and restart it using the following commands:
- Stop the docker session with the
exitcommand - Save the session with:
docker commit <CONTAINER ID> athena:21.0.38, where the hashCONTAINER IDis the hostname or container ID of the docker machine. If the hash is not visible, the following command will print a list of existing containers:docker ps -a - Restart the saved docker image with:
docker run -i -t -v /cvmfs:/cvmfs -v $HOME:$HOME athena:21.0.38
Upload a Docker image¶
If you want to share a docker image with other users, you can create a local snapshot and upload it to Docker Hub. Remember to remove your grid credentials from the image if you had copy them to it.
- Create a Docker Hub account at: hub.docker.com
- Make a snapshot after exiting the docker machine with, e.g.,
The meaning of
docker commit <CONTAINER ID> athena:21.0.38CONTAINER IDwas explained in the previous section. - Get the
IMAGE IDhash with:Note: this is different from the container ID!docker images -
Rename/tag the image to match your docker account name and use the previously listed docker image ID hash
(Replacedocker tag <IMAGE ID> username/athena:21.0.38usernamewith your Docker Hub account name) -
Provide Docker Hub credentials with
docker login - Push the tagged image to Docker Hub with:
docker push username/athena:21.0.38