GUI Application inside Docker Container
First let’s start with..
What is Docker ?
Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly. With Docker, you can manage your infrastructure in the same ways you manage your applications. By taking advantage of Docker’s methodologies for shipping, testing, and deploying code quickly, you can significantly reduce the delay between writing code and running it in production.
What is a GUI ?
GUI is 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.
Task Description 📄
📌 GUI container on the Docker
🔅 Launch a container on docker in GUI mode
🔅 Run any GUI software on the container
First install docker and start docker services.
So let’s start..
Step 1 : Pull centos image
docker pull centos:latest
Step 2 : Launch Container
docker run -it --name guicontainer --net=host --env="DISPLAY" --volume="$HOME/.Xauthority:/root/.Xauthority:rw" centos:latest
- - - volume=”$HOME/.Xauthority:/root/.Xauthority:rw” centos:latest : to share the host’s XServer with the container by creating a volume.
- - -env=”DISPLAY” : to share the host display environment to the container.
- - -net=host : to run container with host network.
now, container is started as you can see in below..
Step 3 : Install required Packages
Now install all the required packages inside the container which is python3 and firefox in my condition with the help of yum command.
yum install firefox python3 -y
now install required libraries
pip3 install jupyter
Step 4 : Launch jupyter notebook
jupyter notebook --allow-root
as you can see jupyter notebook launches successfully!! 🙌
🔰Thanks for Reading! Feel free to share your thoughts in comment section 🔰