itplr-kosit / validator

Validates XML documents with XML Schema and Schematron
Apache License 2.0
78 stars 41 forks source link

Cannot reach the daemon as docker container #71

Closed quotschmacher closed 3 years ago

quotschmacher commented 3 years ago

i want to run the daemon inside a docker container to validate XRechnung. my dockerfile looks like

FROM openjdk:16-slim

# Setup needed programs
RUN apt-get update
RUN apt-get install unzip wget -y
#RUN git clone https://github.com/itplr-kosit/validator.git ./validator
#RUN cd ./validator && git checkout tags/v1.4.0
#RUN cd ./validator && ls -l

# Download Validator and unzip
RUN wget https://github.com/itplr-kosit/validator/releases/download/v1.4.0/validationtool-1.4.0.zip -O validator.zip
RUN unzip validator.zip -d validator
RUN ls -l
RUN cd ./validator && ls -l

RUN wget https://github.com/itplr-kosit/validator-configuration-xrechnung/releases/download/release-2020-07-31/validator-configuration-xrechnung_2.0.0_2020-07-31.zip -O validator-configuration.zip
RUN unzip validator-configuration.zip -d validator-configuration
RUN ls -l
RUN cd ./validator-configuration && ls -l

#RUN java -version

EXPOSE 80
EXPOSE 8080

CMD ["java", "-jar", "./validator/validationtool-1.4.0-standalone.jar", "-s", "./validator-configuration/scenarios.xml", "-D", "-P", "8080"]

i build the image with docker build -t daemon_test . and start the container with docker run --rm --network "host" daemon_test.

the daemon starts up fine and is showing me that XRechnung-scenarios are available.

KoSIT Validator version 1.4.0
Loading scenarios from  file:///./validator-configuration/scenarios.xml
Using repository  null
WARNING: Illegal reflective access by com.sun.xml.bind.v2.runtime.reflect.opt.Injector (file:/validator/validationtool-1.4.0-standalone.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int)
WARNING: Illegal reflective access by com.sun.xml.bind.v2.runtime.reflect.opt.Injector (file:/validator/validationtool-1.4.0-standalone.jar) to method java.lang.ClassLoader.resolveClass(java.lang.Class)
WARNING: Illegal reflective access by com.sun.xml.bind.v2.runtime.reflect.opt.Injector (file:/validator/validationtool-1.4.0-standalone.jar) to method java.lang.ClassLoader.findLoadedClass(java.lang.String)
Loaded "Validator Configuration XRechnung 2.0.0" by Coordination Office for IT Standards (KoSIT) from 2020-08-06

The following scenarios are available:
  * EN16931 XRechnung (UBL Invoice)
  * EN16931 XRechnung (UBL CreditNote)
  * EN16931 XRechnung (CII)
  * EN16931 (UBL Invoice)
  * EN16931 (UBL CreditNote)
  * EN16931 (CII)

Starting daemon mode ...
Daemon started. Visit http://localhost:8080

but i can't reach the daemon. i can't even see the gui. what i would like to know: is there an error in calling the daemon command? any incompatibility with the base image or some other obvious failure?

apenski commented 3 years ago

Daemon binds to localhost/127.0.0.1 Use -H 0.0.0.0 to bind to all interfaces. Then your setup will work

quotschmacher commented 3 years ago

stupid mistake - thanks a lot. now it works.