Task-26: Launch a container on docker in GUI mode.

Rishabh
3 min readMar 20, 2021

--

Docker on virtual box

Task Description:

✍GUI container on the Docker
✍Launch a container on docker in GUI mode
✍Run any GUI software on the container

What are our Requirements:

We will be launching the Firefox application which requires the GUI console to be launched but the problem is Docker does not provide the GUI environment, It only provides CLI
So we can use our Host-O.S/Base O.S in our case it is RHEL8 as a server allowing us to use its Display Environment.

Now Let’s Wrap-up the task in 5 Simple Steps!!!
Let’s get started….

STEP:1-Creating a Dockerfile

step-1

Creating a Dockerfile
Installing xhost program at build time .
>>Xhost : The xhost command adds or deletes host names on the list of machines from which the X Server accepts connections.
>>We will be using The X server: it is an application that interacts with client applications via the X11 protocol to draw things on a display and to send input events like mouse movements, clicks, and keystrokes. Typically, one would start an X server which will wait for clients applications to connect to it. The applications will send a stream of commands telling the X server what to draw on the display and letting the client applications know if there’s input events that they should handle. The X server keeps track of what elements in the display belong to which application, manages the layering of images, etc.

STEP:2-Building a Docker Image using Dockerfile

Running the docker file and tagging the container with my_gui5 as it’s name.

STEP:3-Enabling Few things

Checking our Default value of Environment variable, and Enabling Xhost for all the users.

STEP:4-Finally running the command

STEP:5-Now we can see the firefox running.

--

--

Rishabh

Student from B.tech 2nd Year, A proud ARTH learner, love new technologies, Curious about many thing, likes to explore places, love eating pizza and much more.