Launching GUI Application On Docker

Abhinandan Nahar
3 min readMay 30, 2021

If we are building a UI application and deploying it on a docker container. And we want that UI application to display the user interface screen on your local machine while running the application inside the docker container, we have to connect the display of the Docker container with the display of Local Machine. So, here we want Jupyter Notebook which runs on a browser to be run inside docker container.

For any Graphical user interface (GUI) application to run,we need Xserver.

What is XServer?

On Unix-like operating systems, X, typically located at /usr/bin/X, is the original X server executable of MIT’s X Window System. Typically, you do not need to run X manually. If what you’d like to do is start a new X Window session, use the startx command instead.

To Configure Xserver we have to use following command:

Run command yum install python3 to install python in the docker container.

Now, to run jupyter notebook, we should have a browser. So here i am installing firefox browser inside the container using command yum install firefox.

Now, lets install jupyter. pip3 install jupyter.

Now we have to create a workspace where we store our jupyter notebook to train our model.

We have to transfer our dataset from RHEL8 host to our container.For that open a new terminal and type below command.

We need to install some python library to do our work.Used the coomand:pip3 install pandas numpy scikit-learn

To run the jupyter notebook we have to used following command: jupyter notebook — allow-root

Create new python3 notebook

And in this notebook we can train our ML model.

Thanks for reading.