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
Prerequisite:
Docker |
The Docker container should be installed in Linux |
Images |
The Centos Image should be there |
Internet |
The fast internet connectivity should be there |
Red hat Linux |
Red hat Linux Should be installed |
Step 1
Open Terminal in Linux and 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 2
Restart The Docker Service
The Serice of Docker Should start Otherwise it should give some errors
Step 3
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 4
Installation of Firefox In Docker
Step 5
Once the Firefox will be installed in Docker
Step 6
In Container Terminal
Type Firefox
The Firefox Will take Gui from the Linux port X11.