Running a GUI application with docker
- Launch a GUI supported container on docker
- Run any GUI software on the container
Before launching a GUI supported container make sure docker is enabled on your OS and then proceed to pull an image of OS.
Launching a GUI supported container on docker :
Xserver here is used to communicate with clients like xterm, firefox, etc via a reliable stream of bytes. Accordingly set your environment variables and configure DISPLAY server :
set-variable -name DISPLAY -value <your_ip_address>
or you could use the following command to launch the GUI supported container instead :
docker run -it — name <container_name> — net=host — env="DISPLAY" — volume="HOME/.Xauthority:/root/.Xauthority:rw" centos:<version>
Installing relevant dependencies within the container:
If you already have these installed, there is no need to install them again within the same container.
yum install python3
yum install firefox
pip3 install jupyter
Running a GUI application from inside a docker container :
To open Firefox:
To launch Jupyter notebook:
jupyter notebook --allow -root
Hence, in this way you can launch any GUI application from inside a docker container.