Search code examples
dockergotimedockerfile

Error unknown time zone America/Los_Angeles in time.LoadLocation


even through CoreOS shows America/Los_Angeles when timedatectl list-timezones, why does Docker throw error unknown time zone America/Los_Angeles ?

Is there something else need to be done when LoadLocation called running inside a container or anything that can be added to Docker file so it can point to zoneinfo ?

from godoc

The time zone database needed by LoadLocation may not be present on all systems, especially non-Unix systems. LoadLocation looks in the directory or uncompressed zip file named by the ZONEINFO environment variable, if any, then looks in known installation locations on Unix systems, and finally looks in $GOROOT/lib/time/zoneinfo.zip.


Solution

  • For anyone looking for an answer, this helped me.

    adding these two line to docker file , (final if it's a 2 stage build)

    ADD https://github.com/golang/go/raw/master/lib/time/zoneinfo.zip /zoneinfo.zip
    ENV ZONEINFO /zoneinfo.zip