Docker (source: Google)

Run GUI Programs on Docker Container

Run a Docker Container that can run GUI (Graphical User Interface) Programs

  1. Run any GUI software on the container

Prerequisite

  1. Docker Installed on your system.
  2. Docker Host should be GUI based.

Problem

Sometimes we need to run GUI programs in containers to debug or test the things but most of the people stuck there that how to run GUI programs in docker container.

So, Lets get Started

It is very easy to run GUI programs in docker container.

docker run -it -e DISPLAY=$DISPLAY -v /tmp/.X11-unix/:/tmp/.X11-unix/ --name GUIcontainer centos
Launch Docker Container form Centos Linux image
  1. Jupyter notebook (python IDE)
  2. Gedit (Text editor)
yum install firefox -y
Install Firefox browser
firefox
Run Firefox browser in container.
yum install python3 -y
Install python package.
pip3 install jupyterlab
Install ‘jupyterlab’
jupyter notebook --allow-root
Run jupyter notebook
Jupyter notebook launched successfully.
yum install gedit -y
Install ‘gedit’ package in container.
####  gedit <text_file_name>  ####gedit docker
Run gedit
Write something in file and save it.
My python code is executed successfully.