0
Follow
0
View

docker compose Log Time zone

yechuosini 注册会员
2023-02-25 22:24

The answer content section references GPT, GPT_Pro for better problem solving
To let docker-compose log content display for the time is Shanghai time, Add an environment variable TZ in docker-compose.yml and set its value to Asia/Shanghai. The specific code is as follows:

version: "3"
services:
  service_name:
    image: image_name
    environment:
      TZ: Asia/Shanghai

After adding the TZ environment variable, simply restart docker-compose and run docker-compose down & & docker-compose up -d(down indicates to shut down a service, and up -d indicates to start a service). And then execute docker-compose logs -t and you will see that everything in the log is Shanghai time in the East 8 zone.
If the answer is helpful, please accept it.

About the Author

Question Info

Publish Time
2023-02-25 22:24
Update Time
2023-02-25 22:24

Related Question

Dockerfile构建镜像,启动镜像进入容器的目录全路径显示问题

如何为运行Universal Robots模拟器的Docker容器设置网络连接?

nodejs使用log4js日志问题

windows 的docker安装问题

Squid代理:access.log对HTTPS/TLS的长响应时间

AlertDialog闪退

github上的 ImmersionBar如何设置 AlertDialog 背景透明 ?

通过golang在mysql中插入数据时出现Datetime错误

编译kkfileview的docker镜像

在使用WSL2 Ubuntu-20.04发行版的Docker时,无法从Bitbucket中提取项目(项目有IP限制)