5

docker alpine java设置时区

 3 years ago
source link: https://www.wencst.com/archives/719
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

docker alpine java设置时区

作者: wencst 分类: docker,JAVA 发布时间: 2017-11-23 10:22 阅读: 6,741 次

宿主机:CentOS7

docker镜像:jdk1.7+alpine系统

当程序启动时,java程序中获取的时间为UTC时间,那么如何改成ETC时间呢?

1.先将系统时间改为ETC时间

#RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime (注意,alpine系统中没有自带zoneinfo文件夹,从宿主机系统中拷贝即可)
#echo $TZ > /etc/TZ(部分linux系统中需要)

2.修改java程序读取时间

#echo $TZ > /etc/timezone

如果文章对您有用,扫一下支付宝的红包,不胜感激!

欢迎加入QQ群进行技术交流:656897351(各种技术、招聘、兼职、培训欢迎加入)

  • Good day! I know this is somewhat off topic but I was wondering if you knew where I could find a captcha plugin for my comment form? I’m using the same blog platform as yours and I’m having difficulty finding one? Thanks a lot!

    1. Sorry , I didn’t use this plugin. But I think you can search it in Plugins function. Wish it help!

Leave a Reply Cancel reply

You must be logged in to post a comment.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK