GUI Container on the Docker

GUI Container on the Docker

Pre-requisite:

  1. Red Hat Enterprise Linux 8 ( Base OS)
  2. Docker installed in Base OS.

Step1:

Pull Centos:latest image from Docker Hub

docker pull centos:latest

For a GUI Application to run, we need to have a XServer which is available as part of every Linux Desktop Environment, But within a Container we don’t have any XServer — so we will do as follows:

# share the Host’s XServer with the Container by creating a volume

--volume="$HOME/.Xauthority:/root/.Xauthority:rw"

# share the Host’s DISPLAY environment variable to the Container

--env="DISPLAY"

# run container with host network driver with

--net=host

No alt text provided for this image

To check whether we are in docker container of centos:latest docker image, check the following:

No alt text provided for this image

This displays that we are in the docker container of centos image.

Step 2:

Install required packages in docker container.

No alt text provided for this image

Check whether the packages are installed or not:

No alt text provided for this image

Install Jupyter using pip3.

No alt text provided for this image

Launch a jupyter notebook.

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

So the GUI application jupyter notebook is launched successfully.









To view or add a comment, sign in

More articles by Rutuja Sadaphule

Insights from the community

Others also viewed

Explore topics