The created docker container time display error / date error / time zone error
When testing the function of the application a few days ago, I found that the data create_time or update_time field stored in the database was always wrong, other data was normal, only the time field was wrong.
Go to the linux server to check, there is no exception, and then feel that it may be the problem of the docker container. Enter the container and check the system time. It is really different from the time in the host computer. After looking up the information on the Internet for a while, I know the answer, the time zone setting question, China's time zone is East eighth Zone, but it may be different from that of other countries, if no changes are made when creating the container. The time zone may not be East eighth, so a similar problem will arise.
Treatment method:
ENV TZ=Asia/ShanghaiRUN ln-snf / usr/share/zoneinfo/$TZ / etc/localtime & & echo $TZ > / etc/timezone
You can add the above settings to the Dockerfile file that creates the container. Create the container again, and you can see that the system time has been normally displayed as the time of the East eighth Zone.