Task 02- Run GUI Application inside Docker Container
In this blog , I am going to launch two GUI application inside Docker Container ( i.e Firefox and gedit)
Step 1: Pull the Docker Container image from DockerHub.
Here, I have pulled the CentOs image using cmd “docker pull centos".
Use the “docker images" cmd to check the images.
Step 2: Launch Container
Now, we will use the CentOs image to create a new container.
Use Command: ‘docker run -it -e DISPLAY=$DISPLAY -v /tmp/.X11-unix/:/tmp/.X11-unix — name <container_name> centos’
Here, we have added an environmental variable $DISPLAY for the X11 display and mounted a volume /tmp/.X11-unix/:/tmp/.X11-unix for the X11 Unix socket as the X server is responsible for GUI.
Step 3: Launch the GUI Application in the container.
- Launch gedit
First,check whether the application or software is present or not. If it not present inside container, we will install it using yum command.
- Now run gedit.
- Successfully launched the gedit software.
- Launch Firefox
First, check whether the application or software is present or not
- Install Firefox using the yum command.
- Now, run Firefox.
- Successfully launched both the GUI Application inside the docker container.