Mariadb-docker: The Timezone Environment Variable

Created on 12 Oct 2015  路  6Comments  路  Source: MariaDB/mariadb-docker

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?

Most helpful comment

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

All 6 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

danquah picture danquah  路  6Comments

amon-ra picture amon-ra  路  3Comments

shaula picture shaula  路  3Comments

rahonalab picture rahonalab  路  5Comments

citiscaner picture citiscaner  路  3Comments