GUI Application Inside Docker

Today we’ll learn how we can run GUI Applications like Firefox inside a Docker Container.

Step 1:-To use docker first we have to start docker services. And make it enable so it will be on start mode permanently.

Step 2: Pull CentOS Image.

Step 3: Write “export DISPLAY=:0”

What is the meaning of this Command ?

The environment variable DISPLAY tells GUI programs on how to communicate with the GUI. A Unix system can run multiple X servers, i.e. multiple displays. These displays can be physical displays (one or more monitor), or remote displays (forwarded over the network, e.g. over SSH), or virtual displays such as Xvfb, etc. The basic syntax to specify displays is HOST: NUMBER; if you omit the HOST part, the display is a local one.

Step 4: Restart the Docker

The Service of Docker Should start Otherwise it should give some errors.

Step 5: After the start of Docker service then you should type the Docker run command with the use of X11 Port.

X11 Port Explanation:

X11 is the graphical environment for most Unix or Unix-like systems, including *BSD and GNU/Linux; it provides access to screen, keyboard, and mouse. X11 is the Unix and Linux graphics drivers.

Step 6: Installation of Firefox In Docker

Step 7:In Container Terminal

Type Firefox

The Firefox Will take Gui from the Linux port X11.

Thankyou.