docker默认是时区不是东八区,会比我们晚8个小时。所以我们修改为上海的时间。
cat docker-compose.yml 配置文件:
version: '2'
services:
nginx:
image: 'nginx:latest'
restart: always
container_name: nginx
ports:
- '80:80'
- '8081:8081'
- '443:443'
environment:
TZ : 'Asia/Shanghai'
volumes:
- '/app/nginx/conf.d:/etc/nginx/conf.d'
- '/app/nginx/logs:/etc/nginx/logs'
command: nginx -g 'daemon off;'
主要是这一句
environment:
TZ : ‘Asia/Shanghai’