Could we just do this in docker-entrypoint.sh?
...
if [ "$TIMEZONE" ]; then
echo $TIMEZONE > /etc/timezone && dpkg-reconfigure -f non interactive tzdata
fi
# sed is for https://bugs.mysql.com/bug.php?id=20545
mysql_tzinfo_to_sql /usr/share/zoneinfo | sed 's/Local time zone must be set--see zic manual page/FCTY/' | "${mysql[@]}" mysql
...
I just need MySQL to run in my local timezone.
Or is there better way to do this?
What about --env "TZ=Europe/Berlin" to set the timezone to Europe/Berlin for example instead of the $TIMEZONE and removing that dpkg-reconfigure stuff?
Does this not already solve the issue? https://github.com/docker-library/mariadb/commit/a7be78d954009e2acc47fc5a1cb2e7997b54f594
https://github.com/docker-library/mariadb/pull/25
@ypid Thanks!
I am so stupid ....
@zx1986 , @ypid Could you please explain to me what we need to change, please?
I have the same problem...
thanks.
@systec-electronic Hello, I added these into my Dockerfile:
ENV TZ=Asia/Taipei
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
@zx1986 Thanks, but unfortunately it isn't working for me.
@systec-electronic Sorry, my config was wrong!
And I fix it like this:
ENV TZ Asia/Taipei
RUN apt-get update && apt-get install -y tzdata
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && dpkg-reconfigure --frontend noninteractive tzdata
this should be work.
Most helpful comment
What about
--env "TZ=Europe/Berlin"to set the timezone to Europe/Berlin for example instead of the$TIMEZONEand removing thatdpkg-reconfigurestuff?Does this not already solve the issue? https://github.com/docker-library/mariadb/commit/a7be78d954009e2acc47fc5a1cb2e7997b54f594