docker - 错误未知时区America/Los_Angeles在时间。

标签 docker go time dockerfile

即使通过CoreOS在timedatectl list-timezones时显示America/Los_Angeles,为什么Docker也会抛出未知时区America/Los_Angeles 错误

当LoadLocation在容器内运行或在容器文件中添加任何内容以使其指向zoneinfo时,还需要做其他事情吗?

来自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.

最佳答案

对于任何寻求答案的人,这对我都有帮助。

将这两行添加到docker file中,(如果是两阶段构建,则最终结束)

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

关于docker - 错误未知时区America/Los_Angeles在时间。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59094236/

相关文章:

docker - 如何解决 "Hash Sum Mismatch"上的 "apt-get install docker-ce"?

GoLang - 填充结构数组

javascript - JavaScript 的 Date() 对象

python - 使用 Nose/unittest 忽略测试文件

docker - 程序集引用更改后,如何使Azure Functions v2运行时在容器中运行?

json - 为什么 Go 在尝试编码此 JSON 时出错?

c++ - 分辨率与滴答频率

python - 使用 Python 将 ISO 8601 时间格式计算为小时/分钟

mysql - 无法连接到 LAMP docker 容器中的 MYSQL

go - 多个副本访问 kubernetes 中的缓存