356
votes
Accepted
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 ...
208
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
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.
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 ...
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 ...
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/...
36
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/...
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 /...
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, ...
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 ...
20
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/...
19
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. ...
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 && \
...
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:
...
16
votes
Accepted
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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-...
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 ...
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 ...
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) ...
6
votes
Accepted
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 ...
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.
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 ...
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 ...
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....
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
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
timezone × 201linux × 44
time × 43
centos × 23
date × 17
time-synchronization × 14
ubuntu × 13
cron × 13
php × 12
windows × 11
mysql × 10
debian × 10
ntp × 10
windows-server-2008 × 9
docker × 9
redhat × 9
daylight-saving × 7
utc × 6
amazon-ec2 × 5
unix × 5
active-directory × 4
amazon-web-services × 4
bash × 4
logging × 4
centos6 × 4