Running GUI application in Docker with Xming

In this article, I am going to attach the docker container GUI in the windows with the help of Xming app.

Download the application from this website Xming X Server for Windows download | SourceForge.net

Xming is a X server for windows which helps us to display the output from the virtual machines, containers and from cli based OS when we want to run a GUI application

We can configure the settings using the command XLaunch app and choose the display settings

The Display number can be set as you wish and a new port will be open. We can have multiple display numbers to launch multiple instances of xming to connect multiple containers if we wish to

Then click final to save the configuration

If you want to do the process manually, you need to first create a centos container and type the following commands

dnf install -y mesa-libGLU-devel gcc-c++ firefoxexport DISPLAY=<YOUR_IP>:<DISPLAY_NO>/usr/bin/firefox

This is the docker file created. I have uploaded the image in the docker hub if you want to try the same.

docker pull smc181002/gui_on_container

To change the environment variable you can use the -e option when creating the container

docker run -it --rm -e DISPLAY=192.168.0.102:5.0 smc181002/gui_on_container

Now if your configuration was right, the window will open automatically

As you can see, we can access the Firefox from windows which is actually executed in the docker container in my RedHat VM.

Hope you enjoyed the article and found it useful. 😃

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store