GUI inside CentOS Docker Container

Sgrgyanchandani
3 min readMay 30, 2021

--

Today we’ll learn how we can run GUI Applications like Firefox inside a Docker Container. We can easily run most of the common GUI apps without getting into trouble inside a Docker Container. Docker is an Open Source project that provides an open platform to pack, ship, and run any application as a lightweight container. It has no boundaries of Language support, Frameworks, or packaging system and can be run anywhere, anytime from small home computers to high-end servers. It makes them great building blocks for deploying and scaling web apps, databases, and back-end services without depending on a particular stack or provider.

Steps to follow:

Step 1: Firstly you have docker installed in your system. To check it is available or not and to get information about it use command.

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

Step 3: Pull CentOS Image.

Step 4: 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 5: Restart the Docker

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

Step 6: 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 7: Installation of Firefox In Docker

Step 8:

In Container Terminal

Type Firefox

The Firefox Will take Gui from the Linux port X11.

We successfully run the GUI Application inside Docker.

Thanks, for reading…

Follow me on: LinkedIn

--

--

No responses yet