resin region error in docker container docker容器里resin时区的问题

title: resin region error in docker container
date: 2015-04-29 11:08:36 +0800
comments: true
category: Docker
tags: resin,docker

The question

## get system time
[root@c700200529e2 bin]# date
Wed Apr 27 13:40:27 CST 2015

## check resin starting log
Please use CMSClassUnloadingEnabled in place of CMSPermGenSweepingEnabled in the future
Resin-4.0.40 (built Fri, 16 May 2014 11:10:25 PDT)
Copyright(c) 1998-2012 Caucho Technology.  All rights reserved.

  Using Resin(R) Open Source under the GNU Public License (GPL).

  See http://www.caucho.com for information on Resin Professional,
  including caching, clustering, JNI acceleration, and OpenSSL integration.

Starting Resin on Mon, 27 Apr 2015 05:43:20 +0000 (UTC)

## check mysql or redis data related time from resin
the date is also wrong !

## but check mysql instance time in mysql container ,it's correct!
mysql> select now() ;
+---------------------+
| now()               |
+---------------------+
| 2015-04-27 13:54:52 |
+---------------------+
1 row in set (0.00 sec)

Reason

After confirm , the error is from resin application

Fixed

add item `-Duser.timezone=GMT+8:00` into start scripts

[root@c700200529e2 /]# tail -3 /usr/local/resin/bin/resin.sh

exec $JAVA_EXE -cp ${RESIN_HOME}/lib -jar ${RESIN_HOME}/lib/resin-new-hessian.jar **-Duser.timezone=GMT+8:00** -Duser.language=zh -Duser.country=CN -Dfile.encoding=UTF-8 $*

Another method

# add below command into your start script
TZ="Asia/Shanghai"
export TZ

你可能感兴趣的:(resin region error in docker container docker容器里resin时区的问题)