You can run CMS analysis code in a Docker container provided together with the CMS open data. If you have not already installed Docker, instructions for installation are provided by Docker. For an introduction and for getting started, you can follow the links provided in the CMS Open data guide.
In the following instructions, make sure to replace the CMSSW version and the container image name according to the table above. These commands are for 2015 proton-proton data, with the CMSSW version 7_6_7 and the cmssw_7_6_7-slc6_amd64_gcc493 container image.
Once you have installed Docker on your computer, you can fetch a CMSSW image, and create and start a container using the docker run command:
Here we fetch the cmssw_7_6_7-slc6_amd64_gcc493 docker image from dockerhub and name the container my_od.
This will install a stand-alone CMSSW image (several gigabytes). Therefore this may take a while. However, the image will only have to be downloaded once. The following will appear in your terminal, with messages changing during the download:
Unable to find image 'cmsopendata/cmssw_7_6_7-slc6_amd64_gcc493:latest' locallylatest: Pulling from cmsopendata/cmssw_7_6_7-slc6_amd64_gcc493a34e8f61dde2: Already existsc341e9bd0d75: Pull completeb00c4ec204ea: Pull completeb75a825d190f: Pull completec1d073a0336d: Pull complete650dcb078423: Pull complete90c8f402a4b2: Pull complete6fbc78240c7f: Pull complete1a000c4d9168: Pull complete684aeffff49a: Pull complete2bf2b8821c7a: Pull completec3325087056c: Pull completeacc958e9a46a: Pull completeaebfbe474a64: Pull completee869fa526195: Pull complete80a3efb6451b: Pull completeb27531c14546: Pull completedc3997c36289: Pull completeaf1734a85201: Pull complete0a263c644307: Pull completeba24eee3284a: Pull completea622f52fef0b: Pull completeaff80dc8ccdd: Pull complete49f941d726e3: Pull completeDigest: sha256:f5ec05556302a31fd59ce031af06e9a6163990a6d4a64aacf76b7c775667c65eStatus: Downloaded newer image for cmsopendata/cmssw_7_6_7-slc6_amd64_gcc493:latestSetting up CMSSW_7_6_7CMSSW should now be available.This is a standalone image for CMSSW_7_6_7 slc6_amd64_gcc493.
Once done, you should see the commmand prompt for the CMSSW instance within Docker:
If you are using a linux distribution on WSL2, and do not get this prompt, but get back to your local terminal prompt, see the instructions below under "Running CMS open data containers on WSL2".
This does not remove the image, which took long to download. You can create a new container from that image with the same docker run ... command as above, but it will be much faster than the first time.
If the container was created and started using the --rm option (e.g. docker run --rm ...) then the container will be removed when you exit.
For opening graphics windows, the container image has a VNC application installed. Start the VNC application in the container with
You can either install a VNC viewer (e.g. TigerVNC) on your local computer (Linux, MacOS or Windows) and start the viewer there, or open the graphics window in your browser with the http address given in the message.
Connect with the default VNC password cms.cern.
Each time you exit from the container, close the VNC application with
You can find more details on the configuration and usage of VNC in the CMS open data containers in the image repository.
If you are running on a Linux computer, you can also use X11 forwarding. If you already started a container name my_od and now decide to use X11 forwarding instead of VNC, exit from the container shell with exit, remove the existing container with docker rm my_od. Then start a new container with
The CMS open data container images contain the software needed for analysis, and the CMS condition database can be accessed from predefined locations. In the container images for standard proton-proton data, they are stored in a local /cvmfs file system. Therefore, when using these containers, access to the namespace /cvmfs (CernVM-File System) at CERN for software and condition data access is not mandatory.
If desired, it is possible to "see" the full cvmfs space by installing the cvmfs client following the official instructions. In essence, there are two basic ways to achieve this:
The preferred option is to install the cvmfs client locally, on the host machine, and mount it on the container:
Do not mount the full /cvmfs or /cvmfs/cms.cern.ch areas as that will overwrite necessary settings in the local /cvmfs area of the container.
The other option is to install the cvmfs client directly in the container after it is created (only working for the slc6-based containers). For this, the container needs to get started in privileged mode like