1

I am having trouble hosting my JavaFX GUI application on a docker container. My JavaFX GUI application is in a single executable jar file: start.jar This is my dockerfile:

FROM openjdk:11-jre-slim

RUN mkdir logs

RUN apt-get update && apt-get install libgtk-3-0 libglu1-mesa xvfb -y && apt-get update

RUN apt-get install xvfb

COPY library/javafx-sdk-11.0.2 javafx-sdk-11.0.2 

COPY start.jar start.jar

ENV DISPLAY=:99

COPY run.sh /run.sh

RUN chmod a+x /run.sh

CMD /run.sh

And run.sh:

#!/bin/bash
rm /tmp/.X99-lock #needed when docker container is restarted
Xvfb :99 -screen 0 640x480x8 -nolisten tcp &
java --module-path javafx-sdk-11.0.2 -jar start.jar

When I run my start.jar application, I get this error:

ES2 Prism: Error - GLX extension is not supported
    GLX version 1.3 or higher is required

How can I update to the correct GLX version so I can successfully run my JavaFX GUI application on docker?

1 Answer 1

4

You could try disabling the hardware graphics acceleration dependency, by setting a software pipeline for Prism. This can be done by setting the param -Dprism.order=sw.

So the java command inside run.sh should change to:

#!/bin/bash
rm /tmp/.X99-lock #needed when docker container is restarted
Xvfb :99 -screen 0 640x480x8 -nolisten tcp &
java -Dprism.order=sw --module-path javafx-sdk-11.0.2-jar start.jar
Sign up to request clarification or add additional context in comments.

2 Comments

That fixed the issue. I don't get any errors when I run the java command to execute my jar file but my GUI does not show up. Is it even possible to run a JavaFX GUI application inside a docker container?
@AJGoudel - You can run a JavaFX GUI application inside a docker container. You can check this article for an example.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.