X11 forwarding with docker

If you want to use the docker images to interface with the open data, you may sometimes want to use ROOT or some other program from within the container that needs X11-forwarding for the graphics to pop up. If so, you’ll want to start the container in a particular way.

Suppose you’ve fetched an image, following the instructions on the portal.

http://opendata.cern.ch/docs/cms-guide-docker

Once you’ve fetched the image, you may find yourself starting it up again using the following command

docker run -it cmsopendata/cmssw_5_3_32 /bin/bash

However, this does not allow X11-forwarding and you may get errors about your display not being set. Instead, you’ll want to run the following command whenever you want to fire up docker on your local machine.

docker run -it --net=host --env="DISPLAY" --volume="$HOME/.Xauthority:/root/.Xauthority:rw" cmsopendata/cmssw_5_3_32 /bin/bash

Once here, you can type

cmsenv
root

If it has worked, you’ll see the ROOT splash screen.

1 Like