Where do Docker containers get their time information? I've created some containers from the basic ubuntu:trusty image, and when I run it and request 'date', I get UTC time.
For awhile I got around this by doing the following in my Dockerfile:
RUN sudo echo "America/Los_Angeles" > /etc/timezone
However, for some reason that stopped working. Searching online I saw the below suggested:
docker run -v /etc/timezone:/etc/timezone [image-name]
Both these methods correctly set the timezone though!
$ cat /etc/timezone
America/Los_Angeles
$ date
Tue Apr 14 23:46:51 UTC 2015
Anyone know what gives?
Alpine
, you need to installtzdata
first, see here github.com/gliderlabs/docker-alpine/issues/136-v /etc/localtime:/etc/localtime:ro
(CentOS) sort of works. Inside container command-line date returns date in the expected timezone format. BUT jenkins running in container thinks timezone is UTC. Why? /etc/localtime is a symlink to ../usr/share/zoneinfo/UTC in built container. The content of the UTC file in container is now the new timezone. But jenkins (and perhaps other java based software) use the name of the symlink which is still "UTC". Searching for solution . . .