4

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#
haemse
  • 181
  • 1
  • 2
  • 9

1 Answers1

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)

Alexandre Roux
  • 460
  • 6
  • 19