Accessing X Apps from Container

I am troubleshooting some legacy Java web start UI applications. As the Java web start is no longer shipped with the latest JRE, I will not waste time to install it locally on my laptop and later remove it, instead, I will run it from a known container image that has the java web start binary still there.

If run the java web start in a container, then I also need an XWindow environment locally on my Macbook. Hmmm, not preferred. What I really want to do is to minimize any installation on my Macbook.

So Let’s run the X window environment inside the container, expose it through x11vnc, and access it from the Macbook using VNC Viewer.

First let's build Java web start together with the X windows app in the container.

On top of the base jre image, install the virtual x display server xvfb, the x11vnc server, and the lightweight window manager fluxbox.

Then launch the virtual display, start the fluxbox window manager, and run the x11vnc with the display :0. These apps will be all running in the background and we form an infinite loop for the container to be always up.

Build the image and tag it as javaws:1.0

Secondly, run the container with

Lastly, we are ready to access the Xwindow environment in the container.

Tunnel the vnc port 5900 to be available on my Macbook.

On the MacBook, install VNC Viewer, run it, and attach it to localhost:5900. We can access the bash shell,

Then launch the javaws,

Once we have this test working, I don’t think there are too many difficulties to let Kubernetes to manage it.

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