How to Deal with Docker Containers and Timezones using tzdata

Timezones aren’t as standard as you might think. Use tzdata to help standardise them across your containers

Christopher Laine
IT Dead Inside
Published in
4 min readNov 12, 2022

--

Docker and Timezones: Always interesting…

I’ve been working on a migration project to port old .NET Framework apps running on Windows over to .NET Core in containers.

The job is pretty simple: Migrate all packages and code over to .NET standard or .NET Core, recreate the base scaffolding (REST APIs in ASP.NET Core and Worker Services for long-running processes) then test the hell out of all of it.

Luckily, the apps in question have some pretty decent automation testing, including system-level tests to ensure the app works as expected when isolated from all other systems.

So the work is pretty straightforward, until it isn’t.

This is how I ran into the issue of Docker and timezones.

The Issue: Timezone-specific behaviour

In one of the API methods, a posted JSON blob contains — among other things — the timezone of the customer in question. Why would I need a customer’s timezone? In this case, it was to send out notifications to customers but only relative to their office hours. The timezone lets the app know when the customer is…

--

--