我想将 Docker 容器的时区设置为 Europe/Paris,就像主机系统一样。所以我更改了 app.yml:
run:
- replace:
filename: "/etc/timezone"
from: "Etc/UTC"
to: "Europe/Paris"
这个更改生效了,但当我进入容器输入 date 时,时区仍然是 UTC。
我该如何更改时区?有什么想法/提示吗?
我想将 Docker 容器的时区设置为 Europe/Paris,就像主机系统一样。所以我更改了 app.yml:
run:
- replace:
filename: "/etc/timezone"
from: "Etc/UTC"
to: "Europe/Paris"
这个更改生效了,但当我进入容器输入 date 时,时区仍然是 UTC。
我该如何更改时区?有什么想法/提示吗?
找到了解决方案。将此添加到您的 app.yml:
run:
# 设置时区 "Europe/Paris"
# systemd: timedatectl set-timezone 'Europe/Paris'
- exec: ln -fs /usr/share/zoneinfo/Europe/Paris /etc/localtime
- exec: dpkg-reconfigure --frontend noninteractive tzdata
也许这对某些人有帮助。
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.