在 Docker 的 Ubuntu 容器中设置 NTP 和时区

在 Docker 的 Ubuntu 容器中设置 NTP 和时区需要以下步骤:

安装 NTP 服务器:

apt-get update
apt-get install ntp

编辑 NTP 配置文件 /etc/ntp.conf,并在文件中添加要使用的 NTP 服务器,例如:

server 0.ubuntu.pool.ntp.org
server 1.ubuntu.pool.ntp.org
server 2.ubuntu.pool.ntp.org
server 3.ubuntu.pool.ntp.org

重启 NTP 服务:

service ntp restart

设置时区:

dpkg-reconfigure tzdata

posted @ 2023-02-02 11:18  simp00  阅读(852)  评论(0编辑  收藏  举报