Things Learned: Docker Doesn't Inherit Timezone Info

I've been doing a lot of new stuff recently, which I should blog about, but one important thing I learned today: running ASP.NET Core website in a Docker container does not inherit timezone information from the host.

I had some DateTimes from the database (I usually use UTC anyway, but this was an older application revamped so database was in old format). It worked fine on local machine, testing, all. But when deployed it suddenly showed wrong info. Everything was in GMT.

Solution: have to set TZ environment variable correctly for the container and things started working. I will try to remember this...

Add comment

Loading