Launch a container on Docker and Run a GUI software.

Neeraj Nawale
3 min readMay 31, 2021
Docker-Jupyter Image

Let’s say, you want to a UI application to run/control inside docker container. This can be achieved by connecting display of Docker container with display of Local machine. We need X Server to run any GUI application inside docker container.

What is Docker?

Docker is an open platform for developing and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly. It was developed by Solomon Hykes in 2013. Docker is written in Go Programming Language.

What is X Server?

An X server is a program in the X Window System that runs on local machines (i.e., the computers used directly by users) and handles all access to the graphics cards, display screens and input devices (typically a keyboard and mouse) on those computers.

Why to use Jupyter Notebook?

The Jupyter Notebook is an open-source web application that allows you to create and share documents that contain live code, equations, visualizations and explanatory text. Uses include: data cleaning and transformation, numerical simulation, statistical modeling, machine learning and much more.

Steps to create an UI application inside Docker :

Configure X Server and run docker simultaneously

You are inside the docker container. Install necessary tools

Install Python inside Docker container using, yum install python3

Install Firefox inside Docker container using, yum install firefox

Import a dataset for ML programming. At first create a folder inside docker container to save the dataset then, open a new terminal and use the cp command to copy the dataset from local machine to docker container.

The dataset is successfully copied inside docker container. Install pandas library and Jupyter Notebook using the following command.

Run Jupyter Notebook. This will create the UI application (firefox)

Now you can code on the jupyter notebook. On terminal this process is ongoing if you want to terminate it press Left Ctrl + C. To stop the docker, open a new terminal window and use the following command : docker stop imageName/imageID

Successfully done with creating a Jupyter Notebook inside Docker container.

Happy Coding!

--

--