之前记得 debian8 的容器可以通过
root@1a22cc93f1c1:/# echo "Asia/Shanghai" > /etc/timezone
root@1a22cc93f1c1:/# dpkg-reconfigure -f noninteractive tzdata
Current default time zone: 'Asia/Shanghai'
Local time is now: Sun Oct 9 15:09:29 CST 2016.
Universal Time is now: Sun Oct 9 07:09:29 UTC 2016.
现在在 debian9 好像不好使了了.
基于 debian:stretch-slim 镜像,使用 timedatectl 默认是没有这个包的
root@266008c199c0:/# timedatectl set-timezone Asia/Shanghai
bash: timedatectl: command not found
1
msg7086 2017 年 12 月 8 日
Did you mean: dpkg-reconfigure tzdata
|
2
wsy2220 2017 年 12 月 8 日 ENV TZ=Asia/Shanghai
|
3
msg7086 2017 年 12 月 8 日 如果要写脚本的实现的话,可以看看这个: https://stackoverflow.com/a/39275359
|
4
Sharuru 2017 年 12 月 8 日 via Android
如果要和宿主一致,可以单纯的映射 volume 就好。
如果不一致,#1 的 dpkg 就可以满足。 如果要使用 timedatectl,可以自行 apt install。 |
5
Niphor 2017 年 12 月 11 日
docker 吧...debian 系很蛋疼的删除的 tzdata locale 等包 说是要省出那几 M
|