0

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

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 ......

  • but I am already using -v for the data. Is it possible to use -v several times? – Jose Cabrera Zuniga Aug 7 '18 at 17:13
  • Yes, you can mount as many volume as you want. – ETL Aug 7 '18 at 18:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.