eclipse / mosquitto

Eclipse Mosquitto - An open source MQTT broker
https://mosquitto.org
Other
8.61k stars 2.33k forks source link

docker image does not recognise timezone appropriately #3040

Open instantdreams opened 2 months ago

instantdreams commented 2 months ago

Description

Date on host reports according to timezone. Date on container reports in UTC.

Configuration

  1. Create a mosquitto compose.yaml file:
compose.yaml

services:
  mosquitto:
    image: eclipse-mosquitto:latest
    container_name: mqtt
    hostname: mqtt
    ports:
      - 1883:1883 # mqtt
      - 9001:9001 # websockets
    environment:
      - TZ=America/Edmonton
    volumes:
      - /srv/mqtt/config:/mosquitto/config
      - /srv/mqtt/data:/mosquitto/data
      - /srv/mqtt/log:/mosquitto/log
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    restart: unless-stopped

  1. Run compose file using docker compose up --detach

Reproducing Issue

  1. Ensure the container is running
  2. Issue the following commands:
$ docker exec mqtt date
Tue Apr 16 15:35:43 UTC 2024
$ docker exec mqtt cat /etc/timezone
America/Edmonton
  1. Confirm container is running successfully

Environment

Expectation

To rebuild the mqtt docker container to include the tzdata component so it is timezone aware, or to implement another process to support timezones.