michalklempa / docker-nifi-registry

Unofficial Docker Image For NiFi Registry
Apache License 2.0
25 stars 13 forks source link

Wrong timezone in container #18

Open arand-mms opened 4 years ago

arand-mms commented 4 years ago

When I start the container I notice that it is running in a wrong timezone - "date" says it's two hours earlier the in reality in Munich. Is there a way to tell the container which timezone to use? E.g. in the jenkins-container I can use -e JAVA_OPTS=-Duser.timezone=Europe/Berlin but this doesn't work for docker-nifi-registry.

michalklempa commented 4 years ago

Hi, yes you are right. It seems like RunNifiRegistry.java add additional args to command line: https://github.com/apache/nifi-registry/blob/master/nifi-registry-core/nifi-registry-bootstrap/src/main/java/org/apache/nifi/registry/bootstrap/RunNiFiRegistry.java#L883

And these are specified in bootstrap.conf: https://github.com/michalklempa/docker-nifi-registry/blob/develop/templates/bootstrap.conf.gotemplate#L41

As these are currently rendered by me from environment variables statically, you simply cannot add one more java.arg.7 parameter. That is great suggestion for the Docker image, I will add such option in future.

In the meantime, you may reuse existing java.arg.2 (it sets Xms, which, if we do not provide, probably nothing bad happens) for example:

-e BOOTSTRAP_JAVA_ARG_2=-Duser.timezone=Europe/Berlin

Let me know if it works.

arand-mms commented 4 years ago

Hi Michal, thanks for the answer and suggestion! I just tested it, it seems to work.

However, it does not change the timezone on the container's OS (so if you exec a bash in the container, "date" will still show the wrong time), but the registry runs with a corrected time.

Regards, Thomas