Docker JVM Time

dev·2021년 4월 6일

devops

목록 보기
1/2

이슈사항

  • UTC > Asia/Seoul 서버시간 변경
  • Docker에서 linux 타임존은 변경되었으나, 자바 스프링에서는 UTC로 나옴

해결 방법

before

#Start with a base image containing Java runtime
FROM java:8

# Make port 8080 available to the world outside this container
EXPOSE 8080

# Add the application's jar to the container
COPY ./test-0.0.1-SNAPSHOT.war test-server.war

# Run the jar file
ENTRYPOINT ["java", "-jar","/test-server.war"]

after

#Start with a base image containing Java runtime
FROM java:8

# Make port 8080 available to the world outside this container
EXPOSE 8080

# Copy Certfile
COPY ./localtime /etc/localtime
COPY ./timezone /etc/timezone

# Add the application's jar to the container
COPY ./test-0.0.1-SNAPSHOT.war test-server.war

# Run the jar file
ENTRYPOINT ["java", "-jar","/test-server.war"]

참고문헌

Docker 의 timezone과 java application(Spring boot)의 timezone을 맞추자!

0개의 댓글