RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN echo 'Asia/Shanghai' >/etc/timezone
EG、
FROM fiadliel/java8-jre
VOLUME /tmp
ADD api_h5-0.1.jar app.jar
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN echo 'Asia/Shanghai' >/etc/timezone
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]
docker已运行容器里的时区修改
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
或者
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
重启容器即可