Running GUI software on Docker container

Running GUI software on Docker container

What provides GUI to OS

An X server is a program in the X Window System that runs on local machines (i.e., the computers used directly by users) and handles all access to the graphics cards, display screens, and input devices (typically a keyboard and mouse) on those computers.

Communication between an X server and X clients is governed by the X protocol, which is sometimes termed the message format of the X Window System.

First, we would create a docker image that runs any GUI app. I will use Firefox and then run Jupyter notebook on top of it

So, we will make a directory for task 2

# mkdir task2

# cd task2

No alt text provided for this image

# vim Dockerfile

No alt text provided for this image

# docker build -t gui:v1

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

The image is build successfully.

We use the below commands to disable access control because we don't have the rights by any other software to use display. xhost + disable those rights

# echo $DISPLAY

# export DISPLAY=:0

# xhost +

No alt text provided for this image


Now we will launch the container with the help of the image we have created.

#docker run -it --net-host --env="DISPLAY" gui:v1

No alt text provided for this image

Now we will launch jupyter notebook on firefox with the help of GUI.

# jupyter notebook --allow-root

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

We can see that Jupyter Notebook is opened successfully on firefox with the help of GUI.


Shubham Kumar

Sales and Marketing Manager | Boosting Revenue Through Strategic Planning & Market Insights | Marketing Strategist | Technical Engineer

3 年

Good

Jayesh Kumar Jangir

AI Developer @Diro | Red Hat Certified (3X) | GenAI Engineer | MLOps

3 年

Nice

要查看或添加评论,请登录

社区洞察

其他会员也浏览了