Running GUI Applications inside Docker Containers

While the IT world is embracing Containers Technology primarily for Enterprise Server Applications, There is also a huge scope of Docker Containers impacting the Desktop and Development Environment. We leverage this heavily at Admatic, where we containerise every application and service we use — further including the GUI applications and tools that we use for Day to day Development — what took us days is now just a second away. :)

If we want to switch to Deep Learning Dev environment — its 1 Click, If we want Android Dev Env — its just another 1 sec away, Need to integrate Computer vision Algorithms with JNI wrappers for Android NDK Integration with TensorFlow Models — Boom!, just a sec away.

I repeat, what took us few days is now just a second away :)

Want to setup a similar Wow Dev environment at your Office, Get in touch!

Thanks to Docker Containers that is revolutionising the current DevOps landscape and we plan to revolutionise the current development environment landscape with the same.

Here will share you how to Containerise a GUI app in Docker

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

Applications that run as a Background Service (like a Database, WebServer, etc)

GUI Applications that (obviously!) run in the foreground

The second option is what we will see now,

For a GUI Application to run, we need to have a XServer which is available as part of every Linux Desktop Environment, But within a Container we don’t have any XServer — so we will

share the Host’s XServer with the Container by creating a volume

--volume="$HOME/.Xauthority:/root/.Xauthority:rw"

share the Host’s DISPLAY environment variable to the Container

--env="DISPLAY"

run container with host network driver with

--net=host

Use this Dockerfile to build an image with a sample GUI application for testing,