In this first tip & trick, I will show you how to change the timezone in a Linux Alpine Docker container.
These days I'm trying a new system to track the visitors of this blog and their Spanish version focus on privacy. From the settings of this new solution we can't change the timezone, so, I needed to change to the container.
To do that, first, we need to enter to the container:
docker exec -it <id-container> ash
Then, we need to install "tzdata". We can do this typing the following:
apk add tzdata
Once "tzdata" installed, let's explore the next folder:
We need to find the region and the zone and when we found, only need to copy to /etc/localtime. In my case, this is how I do.
cp /usr/share/zoneinfo/America/Montevideo /etc/localtime
To confirm that was successfully, we only need to run the command date.
Tue Apr 14 11:41:02 -03 2020
That's all. Let me know if you have any questions.