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.