Running GUI applications inside Docker Container in RHEL8(Red Hat Enterprises Linux)

I would suggest you to first install docker in RHEL-8. I have uploaded content on how to install docker on RHEL-8 container. If you haven’t, you can refer to my blog:

RHEL-8 supports GUI, through X Server, that runs on local machines and has access to graphic cards, display screens and input devices.
The .Xauthority file can be found in every user’s home directory. It has credentials used by xauth for XServer authentication. When an XServer is started, cookie authenticates connections to that display.

1. Open RHEL-8 terminal.

2. Create Container inside RHEL-8 terminal with host network, using:
— net=host, sharing host display environment to container using:
— env=‘DISPLAY, and by sharing Host’s XServer with the container by creating a volume using: — volume=$HOME/.Xauthority:/root/.Xauthority:rw

docker run -it — name jupyteros — net=host — env=”DISPLAY” volume=”$HOME/.Xauthority:/root/.Xauthority:rw” centos:latest

3. Check if container has been made or no.

docker ps -a

4. Install some of the basic software like ncurses, net-tools, etc.

yum install ncurses net -tool

5. Install Firefox browser so that we could run Jupyter Notebook.

yum install firefox

6. Install Python inside Docker Container.

yum install python3-pip

7. Install Jupyter Notebook inside Docker container.

pip3 install jupyter

8. Make a new directory inside container to store your dataset. (Optional)

mkdir docker-ml
mkdir <directory_name>

9. Transfer the data and check if it has been successfully transferred or no.

docker cp /root/50_Startups jupyteros:/docker-ml
docker cp /root/<file_name> <container_name>:/<location>

10. Download basic python packages in the directory you created for performing operations. (Optional)

pip3 install pandas numpy scikit-learn

11. Open Jupyter Notebook by giving root permissions. Just writing :
jupyter notebook , the application’s GUI won’t appear.

jupyter notebook --allow-root

Using the above steps, you can enable GUI for any application inside Docker Container in RHEL-8.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store