GUI container on the Docker
Here i am running gui software firefox on docker container centos and launching a jupyter notebook on firefox .
I created a directory called sample and created a Dockerfile inside it using the command
#vim Dockerfile
when #vim Dockerfile run a new window is opened.
Press i to insert the data
FROM centos:
RUN yum install firefox -y
CMD ["usr/bin/firefox"]
to save it press esc+:wq+enter
To build an image run # docker build -t firefox .
To verify whether firefox is installed or not run #docker images.
Even though firefox is installed it will not launch successfully because docker container does not have a gui screen to run the firefox. So we need a environmental variable DISPLAY to use the host system's gui screen.run
#docker run -it --env="DISPLAY" --net =host firefox
Here we used --net=host ,when container is launched it provide us the firefox software in gui window, whatever we search in this window needs to go to the docker container via host .
firefox window is popped out on the screen.
GUI firefox is launched successfully.
Run # jupyter notebook --allow-root to launch the jupyter notebook on firefox.
Automatically it(jupyter notebook --allow-root) redirects to a firefox browser .
jupyter notebook is launched on firefox browser.