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

For Windows WSL2, one can use a specific container with vnc and open the graphics on a browser window.

In your WSL2 linux installation:

  • start the container with docker run -it -P -p 5901:5901 -p 6080:6080 cmsopendata/cmssw_5_3_32_vnc:latest /bin/bash
  • run start_vnc in the container (choose a password)
  • open a browser window with the given URL (give the password)
  • start ROOT and you will see the GUI in the browser window