Wrong time in Docker container of Django app built by Jenkins

Viewed 1657

I am comparing two container times. One built on my local machine and the other is built on the Jenkins server.

I attached to both of them and tried these commands:

First: date function of the Linux. The same results:

Locally running container: Sat May 27 10:47:06 UTC 2017

Container running on Jenkins server: Sat May 27 10:47:28 UTC 2017

Second: python shell. The same results:

Locally running container: '2017-05-27 10:59:40.005836'

Container running on Jenkins server: '2017-05-27 10:59:35.567902'

Third: datetime.now() in Django shell (./manage.py shell). Different results:

Locally running container: '2017-05-27 06:01:52.547923'

Container running on Jenkins server: '2017-05-27 11:01:17.001070'

Locally running container is the correct one because in my Django app, I set the timezone to America/Chicago and at the time of this writing this is the correct time.

The one in Jenkins is wrong and looks as if ignoring the timezone set by Django.

I don't understand why. Thank you for any help

1 Answers
Related