Running GUI Applications inside Docker Container

What is DOCKER?

Docker is a set of platform as a service products that use OS-level virtualization to deliver software in packages called containers. Containers are isolated from one another and bundle their own software, libraries and configuration files; they can communicate with each other through well-defined channels.

What is GUI ?

The graphical user interface is a form of user interface that allows users to interact with electronic devices through graphical icons and audio indicator such as primary notation, instead of text-based user interfaces, typed command labels or text navigation.

Lets Directly Jump to Practicles :

Docker Engine Must be Installed in the Base OS / Host .

To confirm whether docker is installed or not we can use :
[root@os]~# docker --version

Docker Engine must be in running state .
[root@os]~# systemctl start docker

[root@os]~# systemctl status docker
Alt Text

We must have a docker image to execute our task .

[root@os]~# docker pull centos:latest

We will now create a Dockerfile in which we will specify our Requirements for our own custom Image

[root@os]~# vim Dockerfile

FROM centos:latest
RUN yum install firefox -y

[root@os]~# docker build -t firefox:v1 .
Alt Text

docker build will help us to make our own customized image with tag firefox:v1
Alt Text

[root@os]~# docker run -it --name task2 -e DISPLAY=$DISPLAY --net=host firefox:v1
Alt Text

$DISPLAY == Enivornment Variable for our Display :0 is the main display.
--net=host == Using Socket to make connect between docker and base OS (Host)

[root@os]~# firefox

[root@os]~# jupyter notebook

In Addition to firefox i used jupyter notebook as a GUI APP.

Thanks for Visiting my Article

17