docker alpine java设置时区
一、环境
宿主机: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
Tim Monte
June 9, 2018 at 12:13 pm
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!
wencst
June 19, 2018 at 4:00 pm
Sorry , I didn’t use this plugin. But I think you can search it in Plugins function. Wish it help!