GUI container on the Docker

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

No alt text provided for this image

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"]

No alt text provided for this image

to save it press esc+:wq+enter

To build an image run # docker build -t firefox .

No alt text provided for this image

To verify whether firefox is installed or not run #docker images.

No alt text provided for this image

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

No alt text provided for this image

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.

No alt text provided for this image
No alt text provided for this image

GUI firefox is launched successfully.

Run # jupyter notebook --allow-root to launch the jupyter notebook on firefox.

No alt text provided for this image
No alt text provided for this image

Automatically it(jupyter notebook --allow-root) redirects to a firefox browser .

No alt text provided for this image

jupyter notebook is launched on firefox browser.

No alt text provided for this image


To view or add a comment, sign in

More articles by Srilekha Mule

  • K-means Clustering

    What is Clustering? Clustering is one of the most common exploratory data analysis technique used to get an intuition…

  • Face Recognition.................

    Task 6.1 Collecting Samples import cv2 import numpy as np # Load HAAR face classifier face_classifier = cv2.

  • JavaScript

    What is JavaScript? JavaScript(JS) is a text-based programming language used both on the client-side and server-side…

  • Confusion Matrix

    Confusion Matrix: A Confusion matrix is used for evaluating the performance of a classification model. The matrix…

  • How to run a machine learing model on Docker

    Step1: Pull the docker container image of centOS image from DockerHub using the following command: # docker run -it…

    2 Comments

Others also viewed

Explore content categories