Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker image does not recognise timezone appropriately #13937

Open
instantdreams opened this issue Apr 16, 2024 · 1 comment
Open

docker image does not recognise timezone appropriately #13937

instantdreams opened this issue Apr 16, 2024 · 1 comment

Comments

@instantdreams
Copy link

What did you do?

  1. Run prometheus in container, passing "TZ" environment variable and "localtime" and "timezone" volumes
  2. Executed the following commands:
$ docker exec prometheus date
Tue Apr 16 14:34:35 UTC 2024
$ docker exec prometheus cat /etc/timezone
America/Edmonton

Timezone is correct, reported time is incorrect.

What did you expect to see?

Result should be MDT

What did you see instead? Under which circumstances?

Result was in UTC

System information

Linux 6.1.0-18-amd64 x86_64

Prometheus version

prometheus, version 2.51.2 (branch: HEAD, revision: b4c0ab52c3e9b940ab803581ddae9b3d9a452337)
  build user:       root@b63f02a423d9
  build date:       20240410-14:05:54
  go version:       go1.22.2
  platform:         linux/amd64
  tags:             netgo,builtinassets,stringlabels

Prometheus configuration file

n/a

Alertmanager version

n/a

Alertmanager configuration file

n/a

Logs

prometheus compose.yaml file

services:
  prometheus:
    image: quay.io/prometheus/prometheus:latest
    container_name: prometheus
    hostname: prometheus
    command: --config.file=/etc/prometheus/config.yaml
    ports:
      - 9090:9090 # web ui
    environment:
      - TZ=America/Edmonton
    volumes:
      - /srv/prometheus/etc-prometheus:/etc/prometheus
      - /srv/prometheus/data:/prometheus
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    restart: unless-stopped
@rgroothuijsen
Copy link
Contributor

Remarkably, not setting the TZ variable did cause the localtime file to be read correctly when I tried this. Take note that Prometheus will display the time in UTC regardless, as described in the FAQ.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants