How To Launch Gui Application In Docker

Hey, guys hope you all are doing good in today's article we are going to launch a GUI application inside the docker container sounds interesting, isn't it?

First, we will create our docker image with the required software for that use the code provided below here I am installing Mozilla in docker you can install the software according to your need.

FROM centos:8
RUN yum install firefox -y
CMD firefox

To build your Image first create a folder with any name you like inside it make one file name Dockerfile make sure to use exactly the same file name and put the above code in that code we are telling docker to use centos as a base image and install the firefox RUN keyword during build time and CMD keyword run while creating the container after all the step run the below command to build the image.

docker build -t [image name] .

Once the image is created now we have to launch the container from our image for launching the container use the below command.

docker run -it [container name] — — env=”DISPLAY” — — net=”host” [imagename]

In the above command, we are using env= display variable which will use your host system display when you print display variable it will show 0 by default and 0 points to host screen, and net=host is used so that when container I launched it will launch in hos network stack so that we can directly access it if not use this it will use bridge connection.

Guys, here we come to the end of this blog I hope you all like it and found it informative. If have any query feel free to reach me :)

Guys follow me for such amazing blogs and if have any review then please let me know I will keep those points in my mind next time while writing blogs. If want to read more such blog to know more about me here is my website link Please do not hesitate to keep 👏👏👏👏👏 for it (An Open Secret: You can clap up to 50 times for a post, and the best part is, it wouldn’t cost you anything), also feel free to share it across. This really means a lot to me.




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

Recommended from Medium

Toward an Affect-Sensitive AutoTutor

What to Look for When Hiring a Java Developer

Deploy Consul on AWS EKS using Terraform and Helm

Connecting to Oracle Autonomous Data Warehouse (ADW) from Mac using Python / Tableau / SqlDeveloper

Concurrent Updates — Lost Change Problem

Scrum is Culture

Don’t Memorize Kubernetes API Resources. Use These Two kubectl Commands Instead!

How to run and debug Apache Superset using Pycharm or IntelliJ

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
Gupta Aditya

Gupta Aditya

More from Medium

Backups on MongoDB

PostGreSQL, Debian, and libpq-

Export all API names from APIGEE Cloud

Hosting multiple containerized websites on a single server