Run Java Gui Application in Docker Container

calgara12 :

i want to run a Java GUI application inside a docker container which then will be hosted on my Ubuntu Server. I want to access the application through a web browser.

Here is the application i want to put inside the Docker Container: https://github.com/Dabomstew/universal-pokemon-randomizer

Would i have to add a custom UI for the app in the browser, or is it possible to use the java gui inside the browser?

I have seen this done with a few other projects so i think it should be possible. I am not sure how exactly this was done and how much work this would require though...

Here are some examples of java gui applications running in a docker container:

I am new to docker, i hope anyone can help me :) Thanks!

David Maze :

Browsers can run a very limited set of language runtimes; essentially only Javascript and things that can be recompiled into Javascript. There's not a generic way to take a running desktop application and republish it into a browser.

Docker here is just an intermediate layer. It's very good for things like HTTP servers that are self-contained except for a network port; okay for command-line applications (if you don't mind running it as root with a command line three times as long, it works fine); and bad for GUI applications (works only on Linux, the command lines are long and arcane, and things are still highly likely to look different). It doesn't provide any magic to cross these layers.

You might be able to find some existing software that can fill some of these gaps; perhaps a browser-based X server, or maybe one of the full-blown VM systems can display a VM's desktop in a browser, or maybe you might be able to use the all-but-dead Java applet system, or maybe there's a Java layer that provides a websocket-based client and lets you run your Java-native GUI application with minor modifications.

I'd encourage you to first make your application work, and solve the "how do I actually make it appear the way I want" problem, and only then bring in Docker if it's appropriate. The layer of separation it provides can make many things more difficult especially while you're actively developing or exploring an unknown space.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=159114&siteId=1