Running GUI-image on DOCKER(2)

AnujGupta
4 min readMay 30, 2021

Task Description đź“„

đź“Ś GUI container on the Docker

đź”… Launch a container on docker in GUI mode

đź”… Run any GUI software on the container

X Window System

The X Window System X11 is a windowing system for bitmap displays, common on Unix-like operating systems.

X provides the basic framework for a GUI environment: drawing and moving windows on the display device and interacting with a mouse and keyboard. X does not mandate the user interface — this is handled by individual programs. As such, the visual styling of X-based environments varies greatly; different programs may present radically different interfaces.

XServer — X is an architecture-independent system for remote graphical user interfaces and input device capabilities. Each person using a networked terminal has the ability to interact with the display with any type of user input device.

Xserver X11

X11 is the latest version of softwear of the XServer

Developed by MIT by X.org foundation

X11 is a softwear which is already present in linux based OS eg. RHEL distribution etc .

XServer is the heart of LINUX GUI it helps to manage your mouse and keyboard

XServer — we call it as server bcoz it has capability to display o/p not only on the local monitor connected but a monitor connected via network

we can control where the XServer softwear in OS should display its i/p by using the $DISPLAY env variable .

The DISPLAY env variable contains the IP address of the system where the XServer is going to send its display output .

Now lets run an gui application on docker

Here i will be running [“jupyter notebook”] on docker container on linux system .

First check the DISPLAY env variable on host OS its >> [:0]

Using docker run cmd and checking out help option ,

we have -e for giving env variable for image here i’m using [centos] .

and -v for mounting volume we need to use these two options to make our container use display of the base of .

Now using these 2 options launch the container

What happens is that by default there is not value assigned for the DISPLAY variable in container

So we are assigning our base OS’s values to the [Container/Image]

Here is the proof that the containers dont have any thing stored for the DISPLAY variable … echo $DISPLAY prints nothing .

Now installing required softwears inside the container .

Installing [python , (jupyter library)] and [firefox] , on the container .

Now using jupyter notebook command launching the application .

DONE :)

  • Here container is providing data to the volume we mounted to the BASE_OS and ,
  • DISPLAY env variable has assigned the host’s display to container and with the help of XServer softwear which has capability to work remotely ,the data is displayed from container to the display of host.

--

--