GUI Container on the Docker
Pre-requisite:
- Red Hat Enterprise Linux 8 ( Base OS)
- 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
To check whether we are in docker container of centos:latest docker image, check the following:
This displays that we are in the docker container of centos image.
Step 2:
Install required packages in docker container.
Check whether the packages are installed or not:
Install Jupyter using pip3.
Launch a jupyter notebook.
So the GUI application jupyter notebook is launched successfully.