💢GUI Application Inside Docker Container….🐳🐳

Ankita Patil
3 min readJun 1, 2021


✨What is Docker ?

Docker is an open source containerization platform. Docker enables developers to package applications into containers — standardized executable components that combine application source code with all the operating system (OS) libraries and dependencies required to run the code in any environment.

While developers can create containers without Docker, Docker makes it easier, simpler, and safer to build, deploy, and manage containers. It’s essentially a toolkit that enables developers to build, deploy, run, update, and stop containers using simple commands and work-saving automation.

✨GUI application in Docker means What ?

If we talk about the running nature of any application, you can find only two of them:

  • Applications that run in the background such as webservers.
  • Applications that run in the foreground (generally, GUI based) such as a web browser.

In this blog, I am going to show you how to run this second type of application inside a docker container using X Server

Task Description 📄

📌 GUI container on the Docker

🔅 Launch a container on docker in GUI mode.

🔅 Run any GUI software on the container.

Step-1 : Install docker in your system

A) Configure yum for Docker repo :

Create a file “/etc/yum.repos.d/docker.repo”
name=docker repo baseurl=https://download.docker.com/linux/centos/7/x86_64/stable/

After this verify by “yum repolist” . You see some more software.

Step-2 : Pull centos image

docker pull centos:latest

Step-3 : Launch a Container

docker run -it — name <os_name> — net=host — env=”DISPLAY” — volume=”$HOME/.Xauthority:/root/.Xauthority:rw” <image>:<version>

We have to provide this as a option to share docker host i.e in our case RHEL8 XServer.

# share the Host’s XServer with the container by creating a volume
--volume="$HOME/.Xauthority:/root/.Xauthority:rw"# to share the host display environment to the container.
--env="DISPLAY"# to run container with host network

Now, run the container by providing these option.

verify by checking the container is launched and the process is started or not ?

# To check whether the process is started or not(i.e. container is launched or not) 
docker ps

Step-3: Install required packages inside the container

# python package
# firefox packageyum install python36 firefox -y

let’s verify whether the packages are successfully installed or not?

# To verify the firefox package
rpm -q firefox# To verify the python package
rpm -q python36

Step-4: Install required libraries

# installing required libraries for task
pip3 install jupyter

Let’s launch jupyter notebook :

# To launch the jupyter notebook
jupyter notebook --allow-root

Thank You….!!!!😊