Closed tholu closed 7 years ago
I got it working by adjusting the Dockerfile like this:
FROM jetty:9.3-jre8-alpine
EXPOSE 8080
ADD /target/myapplication.war /var/lib/jetty/webapps/ROOT.war
ADD /jetty.xml /usr/local/jetty/etc/jetty-nosql.xml
RUN java -jar "$JETTY_HOME/start.jar" --add-to-startd=nosql --approve-all-licenses
CMD ["java","-Djava.io.tmpdir=/tmp/jetty","-jar","/usr/local/jetty/start.jar", "--debug"]
It now replaces the local config file in /usr/local/jetty/etc/jetty-nosql.xml
. You also have to make sure that mongo
listens on the right ip address or on 0.0.0.0
.
Glad you figured it out. I would probably recommend a containerized Mongo in this case instead of running it on the Docker host.
@md5 Yes you're right, but then you still have to change the mongo URL from 127.0.0.1 to mongo
(or how you name the container), and figuring out how to do this was the hard step here (at least for me).
I'm trying to configure mongo (running on the docker host) as a session manager for jetty, but if fails because it cannot connect. Does anybody have a working example of how this can be achieved?
I'm getting this exception:
I actually try to overwrite the config like that in my Dockerfile:
It seems that the config done in
/var/lib/jetty/jetty.xml
is ignored, where I set theServerAddress
to a different host. Any pointers?