Launching a GUI Application in Docker Container
Task Description ๐
๐ GUI container on the Docker
๐ Launch a container on docker in GUI mode
๐ Run any GUI software on the container
Pre-requisite
โ Docker should be installed in a System.
To check whether Docker is installed in your system or not, run the following to command to check it out.
command-: docker info
Now to start docker service type systemctl start docker command. After typing this command check the status of running docker service using command systemctl status docker
So our docker service is running. Itโs time to pull image from DockerHub to our base OS Red Hat Enterprise Linux 8
Command to pull image from DockerHub-: docker pull <image_name>:<version_name>
Here, I am using CentOS latest image. To see downloaded images in docker
Command-: docker images
Now itโs time to launch container on docker in GUI Mode.
Command-: docker run -it --net=host --env="DISPLAY" --name GuiOS -p 1234:8888 centos:latest
๐ โ -net = for using hostโs network.
๐ -env = for using environment variable (DISPLAY).
๐ -p = for binding 8888 port no with port no.1234 of Dockerhost.
Now install any GUI Application inside container. Here I am installing Jupyter and Firefox.
command to install jupyter-: pip3 install jupyter
command to install firefox-: yum install firefox
Note-: For installing jupyter, you firstly have python3 installed in container. For installing python3 -:
Command-: yum install python3-pip
Jupyter installation
Firefox installation
After installation of these applications itโs time to launch a GUI application.
Here, I am launching jupyter application with root user access.
Note-: Firefox must be installed in order to run jupyter.
Command-: jupyter notebook --allow-root
Hurray!โฆ We successfully run GUI Application inside docker container.๐
Jupyter notebook running
Thanks for readingโฆ ๐