Running GUI from a docker container

I am getting the error below when I try running fsl GUI (fsleyes). Can anyone help? please provide as more details as possible.

(base) $ docker run --rm -it -e DISPLAY=unix$DISPLAY fsl/5.0.10

Some packages in this Docker container are non-free

If you are considering commercial use of this container, please consult the relevant license:

https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/Licence

root@d0ad6a4f645e:/# fsleyes

Unable to access the X Display, is $DISPLAY set properly?

Hi @mohebyani!

@kaczmarj has a potential solution on GitHub

To recap his answer:

  1. run xhost local:root (if you are using mac/linux)
  2. docker run --rm -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY fsl fsleyes

Where the difference appears to binding the /tmp/X11-unix path to the container.

If you are using windows, the solution may be more complicated.

Running GUI applications through docker containers has been a pain for me in the past, so I empathize. (today I really only use browser-based GUIs for applications that run through the browser and use applications like FSL through the command line).

Hope this helps!
James

Hello James,
Thank you. Your code worked. I run 1 then 2 (docker run --rm -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY docker-image-name | fsl & fsleyes &).

Best,
Moheb

1 Like