Hello everyone,
I coded a Java/JAX-RS application that runs fine on docker. However when I try to run it using Rancher, it just remains on Initializing status. When I check the log from Rancher everything is fine, but for some reason Rancher does not detect it is already running and keeps the Initializing status. Here’s a successful log example that I get from both Docker and Rancher:
Aug 26, 2016 12:50:39 AM org.glassfish.grizzly.http.server.NetworkListener start
INFO: Started listener bound to [0.0.0.0:9090]
Aug 26, 2016 12:50:39 AM org.glassfish.grizzly.http.server.HttpServer start
INFO: [HttpServer] Started.
Aug 26, 2016 12:50:39 AM com.domain.services.quotes.Main main
INFO: App started with WADL available at http://0.0.0.0:9090/quotes/v1/application.wadl
My Dockerfile is:
FROM java:8
MAINTAINER Andres Jaimes
RUN mkdir -p /usr/local/share/service-quotes/lib
COPY ./target/service-quotes-1.0.jar /usr/local/share/service-quotes
COPY ./target/lib/* /usr/local/share/service-quotes/lib/
ENTRYPOINT ["java", "-jar", "/usr/local/share/service-quotes/service-quotes-1.0.jar"]
EXPOSE 9090
From here you can see that my entry point is a Java application. It is enabled to respond to SIGTERM so it shutdowns gracefully when requested by docker.
I don’t really know where to look. Docker and Rancher logs are both the same, but in Rancher status does not go further than Initializing, so it keeps restarting the container.
Update
After some tests I found that rancher remains at the Initializing state because of the health checks.
Update 2
Ok, it seems that everything was related to how the following parameters were setup.
- Initializing Timeout: The number of milliseconds before we exit initializing.
- Check interval: The number of milliseconds between checks.
- Check Timeout: The number of milliseconds before a check without response times out.
My setup had a large Check Interval, so it didn’t check before the initialization timed out.
Everything’s working now.
Andres