Run GUI software on Docker Container

Garvit Garg
2 min readAug 11, 2021

To run a GUI Software on the top of any Docker Container we need to create or build a docker container with docker image containing that GUI software.
Now to install the GUI software in docker image we will do following steps :

  1. Start and pull a docker image in our CLI.
  2. Install GUI software in docker image.
  3. Run docker image.

Let’s start :

Start and pull a docker image in our CLI :-

To start with lets start our docker by

CMD : systemctl start docker

Now as our docker is active lets pull our docker image by

CMD : docker pull <Docker_image>centOS

As we see we have Docker images installed.

Before proceeding to next step lets check weather our container can run firefox or not, so for that we will run our container and then run the firefox commend to check.

CMD : docker run -it — name (Name_of_OS) (image_name)

CMD : firefox

As we can see we don’t have any GUI software named firefox installed.

Install GUI software in docker image :-

Now to install GUI software in Docker image we need to open dockerfile and type the cmds there.

CMD : vim dockerfile

After saving now if we build any container then that container will consist of firfox and gedit GUI pre-installed in it.

Run docker image :-

CMD : Docker build -t (Container_name)

Now run the container to open firefox GUI.

Thank You !

--

--