dockercomposeyml_1">1 常用docker-compose.yml模版
1.1 java程序
version: '3'
services:trackfusion:image: eclipse-temurin:17.0.12_7-jdkrestart: always container_name: trackfusionprivileged: trueports:- 18080:8080environment:#配置时区- TZ=Asia/Shanghai- SET_CONTAINER_TIMEZONE=true- CONTAINER_TIMEZONE=Asia/Shanghaivolumes:- /etc/localtime:/etc/localtime- ./logs:/opt/logs- ./trackfusion-1.0.jar:/trackfusion-1.0.jar- ./config/application.yml:/application.yml- ./config/targetid.data:/opt/track/targetid.datalogging: driver: "json-file"options: max-size: "500m"max-file: "2"entrypoint: java -Djava.security.egd=file:/dev/./urandom -Dspring.config.location=/application.yml -jar /trackfusion-1.0.jar -Xms1024m -Xmx10240m
2 设置时区
environment:
#配置时区
- TZ=Asia/Shanghai
- SET_CONTAINER_TIMEZONE=true
- CONTAINER_TIMEZONE=Asia/Shanghai
volumes:
- /etc/localtime:/etc/localtime
如果主机时区和docker 需要不一致 ,则修改为
- /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime