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
# vim Dockerfile
# docker build -t gui:v1
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 +
Now we will launch the container with the help of the image we have created.
#docker run -it --net-host --env="DISPLAY" gui:v1
Now we will launch jupyter notebook on firefox with the help of GUI.
# jupyter notebook --allow-root
We can see that Jupyter Notebook is opened successfully on firefox with the help of GUI.
Tech Pursuer
3 年Great
Sales and Marketing Manager | Boosting Revenue Through Strategic Planning & Market Insights | Marketing Strategist | Technical Engineer
3 年Good
AI Developer @Diro | Red Hat Certified (3X) | GenAI Engineer | MLOps
3 年Nice