1

Within my docker container I run:

root@77defb7a21e5:/# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 8.9 (jessie)
Release:    8.9
Codename:   jessie
root@77defb7a21e5:/# date
Tue Aug  7 16:54:14 UTC 2018
root@77defb7a21e5:/# dpkg-reconfigure -f noninteractive tzdata

Current default time zone: 'America/Denver'
Local time is now:      Tue Aug  7 16:54:23 UTC 2018.
Universal Time is now:  Tue Aug  7 16:54:23 UTC 2018.

What, from within the container, needs to be set to make the local time the true America/Denver?

My container was created using:

  sudo docker run --name=my_db --network=my_nw -v /opt/mydata:/var/lib/postgresql/mydata -e POSTGRES_PASSWORD=somepassword -d postgres:9.5.9

and I got the file /etc/timezone to have only America/Denver. I also re-started the container but no luck

Gryu
  • 479
  • 1
  • 6
  • 14
Jose Cabrera Zuniga
  • 169
  • 1
  • 3
  • 10

1 Answers1

1

Assuming the timezone you want is the same as the host, the best way I found to do this is as follow:

docker run -v /etc/timezone:/etc/timezone:ro -v /etc/localtime:/etc/localtime:ro ......

ETL
  • 6,443
  • 1
  • 26
  • 47