Running GUI Application in the docker container

Shristi Agarwal
2 min readSep 6, 2021

So, here we will see that, how to launch a GUI application on the docker container.

By default GUI application don’t run on the docker container, but by changing some environment variables we can launch an application in a GUI mode.

Here, I will share you, how ?

Here, I am using RHEL 7 as the host Machine, and Docker-CE engine is installed on it.

Step 1 . Open the terminal and to check internet connectivity use the ping command.

# ping goo.gl

Step 2 Restart your docker services

#systemctl restart docker

Step 3. Check the status of docker

#systemctl status docker.s

Step 4. Now pull the docker image from the registry, here I am using centos:7 image, after pulling image run this image.

#docker pull centos : 7

#docker run -it centos : 7

Here, I am using Firefox application to run on GUI mode

Step 5 Install the Firefox on the docker image

#yum install firefox -y

Here, Firefox and all its approx. 87 dependencies are installed. (this will take lil time).

Installation of dependencies completed

Step 6. Now exit from docker, using ‘exit’ command

Step 7. Make a new directory, and inside it create a dockerfile using commands

#mkdir myfolder ; #cd myfolder; vim dockerfile

Step 7. Write these commands in the dockerfile given below

Step 8. Now build and tag the docker file using command

#docker build /myfolder/ -t firefox

Step 9. Now run the dockerfile and set the environment, and then your firefox, will run on GUI mode.

#docker container run -it-env = “DISPLAY” — net = host firefox

🐋And your firefox is opened…

Thanks for the read🙃….

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

No responses yet

Write a response