GUI Container on the 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.

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

FROM centos

RUN yum install firefox -y

CMD [“/user/bin/firefox”]

Step 3: Build the image.

docker build -t <give any name>

Step 5: Check the Build image.

docker images

Step 5: Run the Command

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

Step 6: Firefox launched successfully.

Now lets launch jupyter notebook as well.

Firstly install jupyter notebook inside the container.

pip3 install jupyter notebook

jupyter notebook — allow-root

Jupyter notebook running in GUI inside docker container.

THANK YOU!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store