As of May 31, 2023, we have updated our Code of Conduct.
356 votes

Docker Container time & timezone (will not reflect changes)

The secret here is that dpkg-reconfigure tzdata simply creates /etc/localtime as a copy, hardlink or symlink (a symlink is preferred) to a file in /usr/share/zoneinfo. So it is possible to do this ...
Michael Hampton's user avatar
208 votes

How to install tzdata on a ubuntu docker image?

One line only: RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata
petertc's user avatar
  • 2,450
118 votes

Docker Container time & timezone (will not reflect changes)

Usually it is sufficient to set an environment variable in the docker container, like so: docker run -e TZ=Europe/Amsterdam debian:jessie date Of course this would work also with docker-compose.
Victor Klos's user avatar
  • 1,311
113 votes

How to install tzdata on a ubuntu docker image?

You can use ARG and ENV directives to your advantage: ARG DEBIAN_FRONTEND=noninteractive ENV TZ=Europe/Moscow RUN apt-get install -y tzdata This way DEBIAN_FRONTEND will be defined only while you ...
SnakE's user avatar
  • 1,231
53 votes

How to install tzdata on a ubuntu docker image?

You need to execute serie of commands: # set noninteractive installation export DEBIAN_FRONTEND=noninteractive # install tzdata package apt-get install -y tzdata # set your ...
Romeo Ninov's user avatar
  • 4,442
38 votes

Docker Container time & timezone (will not reflect changes)

You can add your local files (/etc/timezone and /etc/localtime) as volume in your docker-container. Update your docker-compose.yml with the following lines. volumes: - "/etc/timezone:/etc/...
Y4roc's user avatar
  • 481
36 votes

What time zone is a cron job using?

Cron job uses the server's define timezone (UTC by default) which you can check by typing the date command in terminal. All countries timezones are defined in /usr/share/zoneinfo directory: cd /usr/...
imvikasmunjal's user avatar
35 votes

automate dpkg-reconfigure tzdata

Since the accepted answer no longer works (Debian Jessie, April 2017), an approach modified from @gertvdijk's comment link appears to do the job now: sudo ln -fs /usr/share/zoneinfo/Europe/Dublin /...
scruss's user avatar
  • 451
24 votes

Invalid time zone 'UTC'

Etc/UTC You are missing Area code defined in the official tz database. The time zone format is Area/Location. For most zones, the Area is a continent and the Location is a major city. For example, ...
Esa Jokinen's user avatar
  • 45.2k
23 votes

Docker Container time & timezone (will not reflect changes)

Mounting /etc/localtime in the image, so it is in sync with host -v is the most popular one. But see issue 12084: it is not correct because it does not work when the software requires instead the ...
VonC's user avatar
  • 2,673
20 votes

how to use TimeZone with Cron tab

Your CRON_TZ= is in a wrong place in your crontab file, as an option attribute for /usr/bin/curl. You should instead have it as an environment variable set before the cron entries: CRON_TZ=Africa/...
Esa Jokinen's user avatar
  • 45.2k
19 votes

Can clients learn their time zone on a network configured using RA?

Stateless address autoconfiguration doesn't provide any way to transmit time zone information, but DHCPv6 does. The DHCPv4 options 100 and 101 correspond to the DHCPv6 options 41 and 42 respectively. ...
Michael Hampton's user avatar
18 votes

Docker Container time & timezone (will not reflect changes)

In ubuntu 16.04 image there is bug. Solution was ENV TZ 'Europe/Tallinn' RUN echo $TZ > /etc/timezone && \ apt-get update && apt-get install -y tzdata && \ ...
qwerty's user avatar
  • 281
17 votes

How to install tzdata on a ubuntu docker image?

Set two environment variables in a docker-compose file. One disables the prompt, and the other sets the timezone. docker-compose.yml version: '3.7' services: timezone: build: . environment: ...
Steven Spungin's user avatar
16 votes

Execute copy and set only if something changed

You can do that by using register and when changed. By using register the result of the copy command is saved into a variable. This variable can then be utilized to create a when conditional in the ...
Henrik Pingel's user avatar
15 votes

Disable Daylight Saving Time (DST) Changes in Linux

Update #1: Timezone database update is released recently for several operating systems under their official repositories. The version tzdata2016g includes settings for the mentioned change. At some ...
vaha's user avatar
  • 496
13 votes

How to install tzdata on a ubuntu docker image?

Make sure if you're using @petertc's solution and are doing apt-get update && apt-get install on the same line that the DEBIAN_FRONTEND statement is after the &&: Right: RUN apt-get ...
Ben J's user avatar
  • 131
11 votes

How to make Jenkins CI use Local time instead of UTC on debian squeeze

Three years later, I found several gotchas getting this to work. So, I'll elaborate upon the accepted answer (which is correct) and add a complete answer for CentOS. Gotcha #1: The Jenkins settings ...
bishop's user avatar
  • 1,076
11 votes

What time zone is a cron job using?

If you have may users, with many crontabs and they have different time zone requirements, you cannot just change system timezone. But you still can set a specific time zone to be used just for the ...
NDonelli's user avatar
  • 127
10 votes

Weird CentOS server behavior time zones

The CST time zone is GMT -6, so if CST time is 15:47 then GMT time is 21:47. If you are saying that at the time you took the screenshot the time was supposed to be 07:48 in the morning, then your ...
ralz's user avatar
  • 2,711
8 votes

Red hat Linux + TIME ZONE CONFIGURATION + details from clock file

With the introduction of RHEL 7 the timezone is managed through systemd, which provides a custom utility to change the timezone: timedatectl To list all available time zones: timedatectl list-...
HBruijn's user avatar
  • 75.2k
8 votes

outlook 2016 (office 365) using incorrect time zone for emails

TimeZone is set in Exchange configuration. It is queried using Get-MailboxRegionalConfiguration, and configured using Set-MailboxRegionalConfiguration. A user guide to modifying localization ...
blaughw's user avatar
  • 2,252
8 votes

Docker - Timezones in containers not same as on host

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 ...
Alexandre Roux's user avatar
7 votes

How to make Jenkins CI use Local time instead of UTC on debian squeeze

In Ubuntu 14.04, none of the above solutions worked for me, but I ended up running the following command, which pulls up an interface where the timezone can be changed from the default (none selected) ...
jmort253's user avatar
  • 449
6 votes

Setting timezone to UTC in unattended install

Removing /etc/localtime will default the system to UTC because there's no "local" time zone (this is what happens when you run tzsetup, as you surmised). For an automated install you simply remove the ...
voretaq7's user avatar
  • 79.7k
6 votes

Red hat Linux + TIME ZONE CONFIGURATION + details from clock file

So the "correct" way to set the clock (at least prior to RHEL 7) is to edit /etc/sysconfig/clock and then run tzdata-update which will then update /etc/localtime; you've just done that step manually.
bodgit's user avatar
  • 4,741
6 votes

What time zone is a cron job using?

While the accepted answer is correct, I would like to add a correction to the verification. The accepted answer says you can verify the system time by typing date in the terminal. When I type date, it ...
Kyle W's user avatar
  • 61
6 votes

OpenShift: Cronjob is executed in wrong timezone despite master configuration is correct

CronJobs are controlled by the master-controller. In Openshift (after ~v3.10), the controllers are run as a pod, defined in /etc/origin/node/pods (at least in our setup). We had the exact same ...
Nils Otto's user avatar
  • 161
6 votes

Is it possible to create a synthetic Timezone GMT+20 in Windows 10?

It is impossible with .NET method TimeZoneInfo.CreateCustomTimeZone , as BaseUtcOffset property should have value between 14 and - 14. Prove:
batistuta09's user avatar
  • 8,936
5 votes

Docker Container time & timezone (will not reflect changes)

if you are using docker image based on ubuntu : # Change the docker default timezone from UTC to SGT echo "Asia/Singapore" > /etc/timezone dpkg-reconfigure tzdata date
Xianlin's user avatar
  • 665

Only top scored, non community-wiki answers of a minimum length are eligible