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.
RUN yum install firefox -y
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 https://avg-g.technology/.Guys 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.