How to runs GUI Application in Docker?

Task :- Launch Firefox in Docker Container

👉 Step1: Configure Docker Yum Repository

baseurl =
gpgcheck = 0
name = docker repo

👉 Step2: Installing Docker

yum install docker-ce --nobest -y

👉 Step3: Verifying docker installation

docker info

👉 Step4: Start the docker services

systemctl start docker 

systemctl status docker

👉 Step5: Create a Docker file

vim Dockerfile
FROM centos
RUN yum install firefox -y
CMD ["/usr/bin/firefox"]

👉 Step6: Build the Docker Image

docker build -t <image name> .

Docker image created successfully, you can verify it by the below command.

docker images | grep skabhi003/firefox

👉 Step7: Launch GUI application On the Docker container

docker run -it --name=os1 --net=host --env="DISPLAY" skabhi003/firefox

--net = for using host’s network

--env = for using environmet varibale(DISPLAY)

👉 At Last , Firefox will launch Successfully.

Thanks, hope you guys will like my article. if you have any suggestion or query will free to ask.




Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

CS373 Spring 2022: Nathan Whyte

Open source Github repository pre-launch checklist

November 2021 | Reach Update


Connect Celery and RabbitMQ with Django

integrate celery and rabbitmq to django

Step by Step Spring Batch Tutorial

Step By Step Spring Batch Tutorial

In a world of Unity — a guide to starting your first unity project

Install NixOS from Ubuntu to another partition

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


More from Medium

What is Application Maintenance?

Class and instance attributes

The Best Guide on Blockchain P2P Framework

How to Use DBMS_CLOUD package to migrate data into Autonomous Database.