Run GUI Application Inside Docker Container

In this article, we are going to learn how to run a firefox browser inside the docker container.

Before starting, make sure you have installed the latest docker in your base os.

Lets start

Step1: Pull the latest centos image from the docker hub

Step2: Creating Dockerfile

Here, we are going to create dockerfile to launch a container.

PackageKit-gtk3-module — Install fonts automatically using PackageKit

Step4: Building the Docker image using the Dockerfile

In this step, we are going to build the Docker image using the Docker build command

  • -tTag option helps us to tag the image with a proper name.
  • Dot (.) operator means that the Dockerfile is used to present in the current folder.

Step5: Launch GUI container from the image

In this step, we are going to launch the gui container using the docker run command

  • --env=”DISPLAY” : — Share the DISPLAY environment variable to the Container OS

The container will basically use the Display adaptor of the Base OS to take the parameters of the mouse pointer, cursor, selected text, etc.

  • — net=host :— Run the OS with the Host’s Network driver

So, we successfully run firefox browser in the docker

Thanks !



Python Enthusiast

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store