230 votes
Accepted

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,680
129 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=Etc/UTC RUN apt-get install -y tzdata This way DEBIAN_FRONTEND will be defined only while you build ...
SnakE's user avatar
  • 1,391
119 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,321
54 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
  • 5,922
39 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
  • 491
38 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
  • 481
37 votes
Accepted

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
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
  • 49.7k
21 votes
Accepted

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
  • 49.7k
20 votes
Accepted

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
15 votes
Accepted

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
  • 516
15 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
  • 151
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
Accepted

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,781
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
  • 80.2k
8 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
  • 81
8 votes
Accepted

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,277
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

What time zone is a cron job using?

Unless you know a priori what time zone cron is running in, the only reliable solution is to check empirically. Otherwise, you might just be checking the time zone of your current shell environment, ...
ruief's user avatar
  • 333
6 votes
Accepted

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,771
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
Accepted

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: https://docs.microsoft.com/en-us/dotnet/api/system....
batistuta09's user avatar
  • 9,096
5 votes

Docker Container time & timezone (will not reflect changes)

Adding my two cents here, because I've tried several of these but none worked on alpine-based images. However, this did the trick: ENV TZ=America/Toronto RUN apk update RUN apk upgrade RUN apk add ...
Alpha's user avatar
  • 151
5 votes

Weird CentOS server behavior time zones

I think the underlying problem is that "CST" is an ambiguous name for a timezone. It can stand for Central Standard Time, China Standard Time, and Cuba Standard Time. [me@risby ~]$ export TZ=GMT ; ...
MadHatter's user avatar
  • 80.5k
5 votes

CentOS not considering daylight saving on timezone

Brazil no longer observing DST is in tzdata-2019b circa July. (ICANN, formerly IANA, is the maintainer compiling the changes.) For some reason, I only find 2019a on the CentOS 8 mirrors. Consider ...
John Mahowald's user avatar
5 votes
Accepted

Linux get UTC offset from current (or other) timezones on given date and time

You can use the date command. You set the timezone and then specify the date and time. The command will return that time with the -03 or -04, so you will know if DST was in effect. For example, for ...
Eduardo Trápani's user avatar
4 votes

Docker Container time & timezone (will not reflect changes)

Using a Fedora container (likely to work with ubuntu also): The simplest solution I found was to use the following in docker-compose.yml environment: TZ: "${TZ:-America/Los_Angeles}" ...
Perry Harrington's user avatar
4 votes

Docker Container time & timezone (will not reflect changes)

In alpine basic Image (example use node:10.16.0-alpine): Dockerfile FROM node:10.16.0-alpine ENV TZ=America/Los_Angeles RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ &...
flynn's user avatar
  • 141

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