V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
ysicing
V2EX  ›  Linux

debian 9 容器时区修改姿势求教

  •  
  •   ysicing ·
    ysicing · 2017-12-08 11:40:32 +08:00 · 3605 次点击
    这是一个创建于 2303 天前的主题,其中的信息可能已经有所发展或是发生改变。

    之前记得 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
    
    6 条回复    2017-12-11 09:53:04 +08:00
    msg7086
        1
    msg7086  
       2017-12-08 12:00:44 +08:00
    Did you mean: dpkg-reconfigure tzdata
    wsy2220
        2
    wsy2220  
       2017-12-08 12:01:57 +08:00   ❤️ 1
    ENV TZ=Asia/Shanghai
    msg7086
        3
    msg7086  
       2017-12-08 12:03:25 +08:00   ❤️ 1
    如果要写脚本的实现的话,可以看看这个: https://stackoverflow.com/a/39275359
    Sharuru
        4
    Sharuru  
       2017-12-08 12:18:10 +08:00 via Android
    如果要和宿主一致,可以单纯的映射 volume 就好。
    如果不一致,#1 的 dpkg 就可以满足。
    如果要使用 timedatectl,可以自行 apt install。
    Niphor
        5
    Niphor  
       2017-12-11 09:39:02 +08:00
    docker 吧...debian 系很蛋疼的删除的 tzdata locale 等包 说是要省出那几 M
    ysicing
        6
    ysicing  
    OP
       2017-12-11 09:53:04 +08:00
    @Niphor 😂😂
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3651 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 10:27 · PVG 18:27 · LAX 03:27 · JFK 06:27
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.