Set timezone for Docker container

I want to set the timezone for the Docker container to Europe/Paris, like the host system. So I changed app.yml:

run:  
  - replace:       
      filename: "/etc/timezone"     
      from: "Etc/UTC"       
      to: "Europe/Paris"

This change works but when I enter date in the container, the timezone is still UTC.

How can I change the timezone? Any ideas/hints?

Found a solution. Add this to your app.yml:

run:
  # set timezone "Europe/Paris"
  # systemd: timedatectl set-timezone 'Europe/Paris'  
  - exec: ln -fs /usr/share/zoneinfo/Europe/Paris /etc/localtime   
  - exec: dpkg-reconfigure --frontend noninteractive tzdata

Maybe this helps someone.

5 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.