查找问题请查看以下两篇文章对你会有帮助:
springboot 解决时区不会出现差8小时的 DockerFile 文件
FROM openjdk:8-jdk-alpine
VOLUME /tmp
ADD tel_api-0.0.1-SNAPSHOT.jar app.jar
# alpine 下修改UTC时间为CST时间 (测试通过)
RUN apk update && apk add ca-certificates && \
apk add tzdata && \
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
echo "Asia/Shanghai" > /etc/timezone
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]
docker-compose.yml 脚本
version: "3.7"
services:
api:
build: ./
image: tel_api_dev
container_name: tel_api_dev
network_mode: "bridge"
volumes:
- /home/huangdehui/docker/tel_api/tel_api_jar_dev/logs:/home/huangdehui/logs
- /etc/timezone:/etc/timezone
- /etc/localtime:/etc/localtime
ports:
- 81:8082
网友评论