5

In all my running docker containers the containers system time is set to UTC whereas on my host (debian) its CEST.

Why dont they sync automaticly? How do i make them set the right time when bringing them up?

root@v2201510680628925:/home/jacob# docker version
Client:
 Version:      1.11.2
 API version:  1.23
 Go version:   go1.5.4
 Git commit:   b9f10c9
 Built:        Wed Jun  1 21:36:47 2016
 OS/Arch:      linux/amd64

Server:
 Version:      1.11.2
 API version:  1.23
 Go version:   go1.5.4
 Git commit:   b9f10c9
 Built:        Wed Jun  1 21:36:47 2016
 OS/Arch:      linux/amd64
root@v2201510680628925:/home/jacob# date
Wed Aug  2 09:59:20 CEST 2017
root@v2201510680628925:/home/jacob# docker exec -it naos_nginx bash
root@0cefa7f7096c:/# date
Wed Aug  2 07:59:34 UTC 2017
root@0cefa7f7096c:/# exit
exit
root@v2201510680628925:/home/jacob# docker exec -it ah_avail bash
root@da52e8f3f61f:/usr/src/app# date
Wed Aug  2 07:59:59 UTC 2017
root@da52e8f3f61f:/usr/src/app# exit
exit
root@v2201510680628925:/home/jacob#

1 Answer 1

8

You should be able to set timezone in your containers by using tzdata :

docker run -e TZ=Europe/Amsterdam debian:jessie date

Credits and further explanation to "Why containers don't sync time with host" : Docker Container time & timezone (will not reflect changes)

2
  • thx, strange that it does not take the tz from the host ...
    – haemse
    Aug 6, 2017 at 1:27
  • 1
    From docker-compose.yml, it's TZ: yourtzname under the environment key.
    – Asclepius
    Jun 9, 2020 at 13:47

You must log in to answer this question.

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