What do you find above?
you will say RedHat 8 linux operating system. But there is something more in this picture. Actually it is default GNOME desktop environment of RedHat linux. GNOME is the open source community which is highly supported by RedHat and other supporters include AWS, Google, Digital Ocean and more.
GNOME 3 provides two user environments:
- GNOME Standard
- GNOME Classic
Both environments can use two different protocols as their graphical back ends:
- The X11 protocol, which uses X.Org as the display server.
- The Wayland protocol, which uses GNOME Shell as the Wayland compositor and display server.
The default combination in RHEL 8 is GNOME Standard environment using GNOME Shell on Wayland as the display server
You can launch the Firefox even when you have no desktop environment. The only need is the display server. For more you can check out https://askubuntu.com/questions/1150493/is-it-possible-to-install-firefox-on-ubuntu-with-no-desktop-enviroment.
What is display server?
A display server is a program which is responsible for the input and output coordination of its clients, to and from the rest of the operating system, and among the hardware and the operating system. Basically, thanks to a display server, you can use your computer graphically (GUI)
I am using X display server on RedHat for our GUI application. Actually we are using X Window System also known as X11, or simply X. X is based on client-server architecture.
Launching Firefox in container
Step 1) Dockerfile
Step 2) Build image
docker build -t IMG_NAME(eg-centosgui) .
Step 4) Allow access to X server
The xhost program is used to add and delete host names or user names to the list allowed to make connections to the X server.
Output- access control disabled: clients can connect from any host.
Step 3) Launch container
docker run --net=host --env="DISPLAY" --name CONTAINER_NAME IMG_NAME
Lets understand the option:
The --net=host option is used to make the programs inside the Docker container look like they are running on the host itself, from the perspective of the network. It allows the container greater network access than it can normally get.Normally you have to forward ports from the host machine into a container, but when the containers share the host's network, any network activity happens directly on the host machine - just as it would if the program was running locally on the host instead of inside a container.--env="DISPLAY" pass through the DISPLAY environment variable from the host into the container. This tells GUI programs where to send their output.
You can see the errors in the terminal.
Build above dockerfile and launch container. Errors will resolved.
That’s Great we have launched GUI application in Docker container.