why i can not change the timezone to CET or Europe/Berlin

[root@server.de ~]# docker run -ti --rm debian:stretch bash
root@b65a4b63c152:/# cat /etc/timezone
root@b65a4b63c152:/# echo 'Europe/Berlin' > /etc/timezone
root@b65a4b63c152:/# cat /etc/timezone
root@b65a4b63c152:/# dpkg-reconfigure -f noninteractive tzdata

Current default time zone: 'Etc/UTC'
Local time is now:      Fri Mar  1 10:31:46 UTC 2019.
Universal Time is now:  Fri Mar  1 10:31:46 UTC 2019.

root@b65a4b63c152:/# ls -l /usr/share/zoneinfo/Europe/Berlin
-rw-r--r-- 1 root root 2335 Dec 31 09:43 /usr/share/zoneinfo/Europe/Berlin
root@b65a4b63c152:/# echo $TZ

root@b65a4b63c152:/# date '+%Z %z'
UTC +0000
root@b65a4b63c152:/# cat /etc/timezone

1 Answer 1


A container is not a VM, it is a process that runs in its own filesystem and network bubble. Some global system settings are inherited from the host. To change the time zone of the process that runs in the container, just set the TZ environment variable. This is the standard Unix way to have your own time zone (on a system which can potentially be shared among users from different time zones).

>> docker run -it --rm debian bash
root@719d5f1d0999:/# date
Fri Mar  1 10:54:56 UTC 2019
root@719d5f1d0999:/# export TZ='CET'
root@719d5f1d0999:/# date
Fri Mar  1 11:55:19 CET 2019

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .