如何在docker json-file中配置时区

时间:2017-09-25 08:43:54

标签: docker

问题

我的docker日志驱动程序是 json-file ,我的机器的时区是+08:00,所以我希望log的时区也是+08:00,但它显示UTC的时区:

docker log

# tail e76c5066b7a8bc1ef693b247a6c015114fc2ed514f8d3a24531ca50386f21c20-json.log 
{"log":"The Jupyter Notebook is running at: http://0.0.0.0:80/\r\n","stream":"stdout","time":"2017-09-16T06:00:06.756948839Z"}
{"log":"Shutdown this notebook server (y/[n])? y\r\n","stream":"stdout","time":"2017-09-16T06:00:08.867852734Z"}
{"log":"[C 06:00:08.867 NotebookApp] Shutdown confirmed\r\n","stream":"stdout","time":"2017-09-16T06:00:08.868239945Z"}
{"log":"\u001b[32m[I 06:00:08.868 NotebookApp]\u001b(B\u001b[m Shutting down kernels\r\n","stream":"stdout","time":"2017-09-16T06:00:08.868924918Z"}
{"log":"\u001b[32m[I 06:00:09.071 NotebookApp]\u001b(B\u001b[m Kernel shutdown: 4feed003-6454-40fb-93dd-ca1ea7a742ec\r\n","stream":"stdout","time":"2017-09-16T06:00:09.071776081Z"}
{"log":"\u001b[32m[I 06:00:09.244 NotebookApp]\u001b(B\u001b[m Kernel shutdown: 728193ed-e546-45dc-98ca-f76b7421d1b1\r\n","stream":"stdout","time":"2017-09-16T06:00:09.245369439Z"}
{"log":"\u001b[32m[I 08:18:31.828 NotebookApp]\u001b(B\u001b[m Serving notebooks from local directory: /root\r\n","stream":"stdout","time":"2017-09-25T08:18:31.829267135Z"}
{"log":"\u001b[32m[I 08:18:31.829 NotebookApp]\u001b(B\u001b[m 0 active kernels \r\n","stream":"stdout","time":"2017-09-25T08:18:31.838264467Z"}
{"log":"\u001b[32m[I 08:18:31.829 NotebookApp]\u001b(B\u001b[m The Jupyter Notebook is running at: http://0.0.0.0:80/\r\n","stream":"stdout","time":"2017-09-25T08:18:31.838287823Z"}
{"log":"\u001b[32m[I 08:18:31.829 NotebookApp]\u001b(B\u001b[m Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).\r\n","stream":"stdout","time":"2017-09-25T08:18:31.838301663Z"}

本地机器时区

# date
Mon Sep 25 16:32:39 CST 2017

我发现没有参数可以从docker docs(https://docs.docker.com/edge/engine/reference/commandline/logs/#extended-description)进行配置。 它是不可修改的还是有一些方法来配置我还没有找到的时区?

环境

我在fedora26和centos7

中得到了相同的结果

Fedora26

# uname -a
Linux boomer.skyinno.com 4.12.13-300.fc26.x86_64 #1 SMP Thu Sep 14 16:00:38 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
# docker info 
Containers: 5
 Running: 1
 Paused: 0
 Stopped: 4
Images: 550
Server Version: 17.06.0-ce
Storage Driver: overlay2
 Backing Filesystem: xfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
......

CentOS7

# uname -a
Linux master24.skyinno.com 3.10.0-514.26.2.el7.x86_64 #1 SMP Tue Jul 4 15:04:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
# docker info
Containers: 70
 Running: 28
 Paused: 0
 Stopped: 42
Images: 391
Server Version: 1.13.1
Storage Driver: overlay2
 Backing Filesystem: xfs
 Supports d_type: true
 Native Overlay Diff: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
......

0 个答案:

没有答案