Running GUI Applications inside Docker Containers

In this blog we will see how to use jupyter notebook in docker container.

  • Applications that run as a Background Service (like a Database, WebServer, etc)
  • GUI Applications that (obviously!) run in the foreground
  • share the Host’s XServer with the Container by creating a volume
  • share the Host’s DISPLAY environment variable to the Container
  • run container with host network driver with
xhost +
export XAUTHORITY=/home/user/.Xauthority
vim Dockerfile
docker build -t gui .
docker run -it --name jupyter --net=host --env="DISPLAY" --volume="$HOME/.Xauthority:/root/.Xauthority:rw" gui
jypyter notebook --allow-root

Happy learning……..



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store