Running GUI applications on the docker container

Sanchita Agrawal
2 min readJun 14, 2021

Hello guys😊

I’ve made a blog article on how you can run GUI applications on Docker Container. 👇👇👇

As you all know that docker is very fast. In just1 sec it can launch the whole OS for you. But docker comes up with CLI only which means you cannot run GUI apps on it. You can’t run doesn't means docker do not support GUI applications.

You know GUI is basically graphics which works on certain drivers behind the scene in any OS. Docker do not have that driver installed in it. If we can install that drive which supports GUI display in docker then we can be able to use GUI in docker. So, lets see what we can do ..👇

📍Previously for this you must have docker installed in your base OS i.e. RHEL8.

📝If you haven’t installed then check the link for clear installation process !!

📍Launch a docker container on the top of your BaseOS.

systemctl start docker

docker pull centos:latest

Launching Docker Container

sudo docker run — net=host — env=’DISPLAY’ — name=GUIcont centos:latest

This — env flag defines a variable in our container that matches our DISPLAY variable on the host.

Running the command

Now Install Firefox using command

yum install firefox -y

install firefox

Run firefox command

firefox

Final output

That’s how you can launch GUI applications in Docker Container.

Although you can use Dockerfile concept if you have more frequent use of GUI in docker container. It will be more convenient.

Thankyou guys !

--

--

Sanchita Agrawal
0 Followers

Computer Science Major || Software Developer@GenusPower