How We Can Run Any GUI Software On Docker?
As we well aware about what is docker?, what are the containers? and how we can deploy our machine learning model on docker? but now one question came into the mind like how we can run and open any GUI application on docker because it seems like to be hard to run it but don’t worry i will tell you how we can run any GUI software on docker…
In this article we are going to perform the following steps
Steps Description:
Launch a container on docker in GUI mode
Run any GUI software on the container
okay umm now let’s start the practical…
First, install docker on your system by using the following commands:
yum install docker
After that you need to start and enable your docker service so for that use:
systemctl start docker
systemctl enable docker
Now we are going to pull an image by using the following command
docker pull centos:8
here we are pulling an image of centos os with version 8
Let’s launch the docker container now…..
here we are given name of our container as vedantos with interactive terminal using -it
command syntax
docker container run -it — name=<any name> centos:8
Now we need to install firefox in our container
To install firefox use command
yum install firefox -y
guess whether our firefox will work or not????umm i think yeah right absolutely not
see..
here, you can see an error related to the DISPLAY environment variable. So for that we are going to set an environmental variable for it.
Go to your localhost and execute the following commands:
In order to proceed further we need to create a directory and then Dockerfile
here you can see that i have created one directory i.e. doraemon and in that again i have created Dockerfile named as Dockerfile
So in Dockerfile we need to write the following commands
Lets built it….
docker build -t firefox .
“.” is also important in order to run all commands so don’t forget to use “.”
if you check our docker images you will find firefox image in display list
now in order to access firefox use
docker container run -it — env=”DISPLAY” — net=host firefox
and after running this command you will get the following output
yeahhh…we did, our firefox is running on our docker container
Thanks for reading…stay tuned for next one…