docker-glpi icon indicating copy to clipboard operation
docker-glpi copied to clipboard

Time and timezone in mariaDB container affect some logs or action log time

Open Wolvverine opened this issue 6 years ago • 3 comments

If mariadb container have another time/timezone then example here /front/crontask.php will be last run time from mariaDB. https://glpi-install.readthedocs.io/en/develop/timezones.html

short workaround:

ocker exec -it mariadb /bin/sh -c "export TZ='Europe/Warsaw'" docker exec -it mariadb /bin/sh -c "rm /etc/localtime" docker exec -it mariadb /bin/sh -c "ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone"

Wolvverine avatar Sep 18 '19 13:09 Wolvverine

I am in mysql and it gives me the same error but those commands do not work for me it runs two hours late compared to Europe / Madrid time

ghost avatar Apr 23 '20 08:04 ghost

Hello, First of all, having different timezones inside the same "infrastructure" is a bad practice. If you have many datacenter across the world you can apply different timezone, but in my mind you must locate glpi and it's database in the same area to avoid this situation. Then, as I read here https://glpi-install.readthedocs.io/en/develop/timezones.html the issue is more related to mysql missing configuration than glpi missing configuration. Since docker image version 2.4.2, the timezone setting is supported in php.

I suggest you to apply the glpi recomendation on your mysql database.

Turgon37 avatar May 09 '20 12:05 Turgon37

You are right about the MariaDB container above. It is associated with setting the same time zone in it as in the others and in the docker.

It would be worth adding to the readme to set it up for container.

docker exec -it mariadb /bin/sh -c "export TZ='Europe/Warsaw'" docker exec -it mariadb /bin/sh -c "rm /etc/localtime" docker exec -it mariadb /bin/sh -c "ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone"

Wolvverine avatar Sep 23 '21 11:09 Wolvverine