Sitemap

GUI Container on the Docker

3 min readMay 30, 2021

--

Press enter or click to view image in full size
Launch GUI Inside Docker

Docker is an open source containerization platform. Docker enables developers to package applications into containers — standardized executable components that combine application source code with all the operating system (OS) libraries and dependencies required to run the code in any environment. While developers can create containers without Docker, Docker makes it easier, simpler, and safer to build, deploy, and manage containers. It’s essentially a toolkit that enables developers to build, deploy, run, update, and stop containers using simple commands and work-saving automation.

Let’s begin with the demonstration

Launch Graphical User Interface Inside Docker Container

Step 1: Create a directory where your code will be saved. In our case dockergui is a directory inside which we will create Dockerfile.

Press enter or click to view image in full size

Step 2: Now after creating Dockerfile write the following code:

FROM centos

RUN yum install firefox -y

CMD [“/user/bin/firefox”]

Press enter or click to view image in full size

Step 3: Build the image.

docker build -t <give any name>

Press enter or click to view image in full size

Step 5: Check the Build image.

docker images

Press enter or click to view image in full size

Step 5: Run the Command

docker run -it — -env= “DISPLAY” — -net=host — -name<give any name > <image name>

Press enter or click to view image in full size

Step 6: Firefox launched successfully.

Press enter or click to view image in full size

Now lets launch jupyter notebook as well.

Firstly install jupyter notebook inside the container.

pip3 install jupyter notebook

Press enter or click to view image in full size

jupyter notebook — allow-root

Press enter or click to view image in full size

Jupyter notebook running in GUI inside docker container.

Press enter or click to view image in full size

THANK YOU!

--

--