GUI Container in Docker

Chavda Himanshu
3 min readJun 1, 2021

Mostly we run our servers or tasks inside Docker Container, but ever imagined — we can even launch GUI applications inside Docker Container & can access them from the Docker Host system.

Docker :

On 2013, Solomon Hykes introduced the biggest innovation of decades called Docker & within 2 years docker & container technology became the most demanding technology in the Industry.

  • Previously when it was taking 10 to 15 minutes to configure & setup a server on VM or over Cloud Computing, there Docker was able to launch the entire OS with pre-configured server in just 1 or 2 seconds. Industry started booming & every company started implementing DevOps solutions like Container Technology.
  • In the mean time Docker also started improving & the biggest profit Docker had at that time was — It was an open-source product. Means thousands of Techy guys started implementing new new ideas on Docker & it also started improving over the years.
  • There’s limitless possibilities Container Technology has but in this blog I gonna talk about one of the very much interesting possibility of Docker Container that is we gonna run GUI applications like firefox.

Running GUI applications on docker

Suppose you are building an application that requires user interface and pops up a window on running the script. And let’s say you want to run that script inside a docker container. Now, you might expect the docker container to run the UI application for you and display the same on your screen. But using normal docker run commands, you won’t be able to see or interact with the UI application. You need to connect the display with the container in order to do so. In this article, we will discuss how to do exactly the same.

Here, we will see how to run a firefox instance inside a docker container and interact with it in your host machine. To do this, we need to first forward the X11 socket to the container so that the container can use it directly. We also need to forward the display environment variable. Even after doing this, it might fail because we have not yet set the permissions for the X server host. This might seem a hefty task at first. We will run you through all the steps in this article.

Now we install the firefox program in our container so we can run the program.

Now we run our Firefox Program…

--

--

Chavda Himanshu

I Am Highly-Motivated, Competent Cybersecurity & Networking aspirant with proven track record in designing the Architecture of a network & security.