Utkarsh Srivastava
2 min readApr 5, 2021


In this section, we will discuss how to launch a GUI application in a DOCKER container.

Docker is powerful container technology. If you want to launch a container just one click and boom! there you go your container is ready to use.

There can be two types of applications (usually services) that you can containerize,

  • Applications that run as a Background Service (like a Database, WebServer, etc)
  • GUI Applications that (obviously!) run in the foreground.

Let’s see how to do it →

  1. First, create an image for your container.

→ Here, I use centos as a base image

→ then install firefox.

→ then run CMD /usr/bin/firefox/ {to start firefox as soon as the container starts.}

→ Now, run the docker build command with the -t tag command to create your image.

docker build -t arthtask .

2. Now, the image is created.

3. Now, we will set the DISPLAY environment. We will launch the docker container with the network same as the host.

docker container run –it –env=”DISPLAY” — net=host firefox

3. Eventually, our container is launched with GUI.

So, this is how we managed to launch a GUI application inside the docker container.

#Linux #GUI



Utkarsh Srivastava