Docker Community Forums

Share and learn in the Docker community.

UPdate docker container JRE to set timezone correctly


(Caneraydinbey) #1

I live in turkey and governent rejected daylight saving recently so in some places, the time is now 15.55 for turkey despite it is 16.55 in real.

My local OS is ubuntu. it’s local date is true. when i type date.

BUt when i ran a java project, the local date was not true.

for this

params.put(“createdDate”, persisted.getCreatedAt().
now(ZoneId.of(Constants.TURKEY_ZONE)).
format(DateTimeFormatter.ofPattern(Constants.DATE_TIME_FORMAT)));

it was 1 hour before. SO i had to manually fix jre with downloading tzupdate tool and tz2016g and ran this command:

java -jar tzupdater.jar -l file home/ vegan /Downloads /tzdata2016g.tar.gz

and this fixed.NOw for local it is true.

We have an app and it has those imagaes

jhipster/jhipster-alerter
jhipster/jhipster-console
jhipster/jhipster-registry
mongo rabibtmq,
vimagick/pure-ftpd
and our company image about 1.8 gb.

and it has around 8-9 microservics up.

This also brings wrong hour when i run the command i posted top of this.

But i couldnot manage to find a way to change jre of docker.

I am inside container of cpmpay. date brings

date
Sun Nov 6 14:04:41 UTC 2016
it is 3 hour before. we are on +2

I should copy file to there but cat or cp doesnot work anymore.

h> ttp://stackoverflow.com/a/39205320/6804200

maybe this can work but i did not test.

We have local machine, test machine and real mchine.Real machne is always up to keep app alive.

The project is spring boot project built by docker. I use inteljidad.

How can i change from code this thing? I couldnot find a way.

Possile ways to update zone

  • run tzupdater.jar inside the container bbecause container has it’s own jre. But i cant find copy and which container.
  • building new image. i dont want this.

any other suggestions?