I am trying to start a Java program in a docker container. After docker-compose build i try to start the program with docker-compose up but get the following error:
Exception in thread "main" java.lang.UnsupportedOperationException: Unable to open DISPLAY
The readme of the progam says: "If you get the error message that the container cannot connect to Xorg (Unable to open DISPLAY) when starting the container, the supplied script "./startup.sh" needs to be executed".
startup.sh:
#!/bin/sh
xhost +local:
docker-compose up
xhost -local:
dockerfile
FROM ubuntu:16.04
RUN apt-get update && apt-get install --assume-yes --no-install-recommends openjfx openjdk-8-jdk maven git
COPY . /opt/Testfolder
WORKDIR /opt/Testfolder/src
RUN mvn package -DskipTests -Dcheckstyle.skip
CMD java -jar program.jar
At what point would i need to execute the startup.sh script? Do i need to add another RUN startup.sh in the dockerfile? Anyone has an idea?