ntop / docker-ntop

A collection of Dockerfile for running ntop applications on Docker
299 stars 31 forks source link

Issue with timezone and docker:stable #17

Open earendilfr opened 1 year ago

earendilfr commented 1 year ago

Environment:

What happened:

I try to start the docker with the localtime correctly configured. But, anytime, he use the UTC and not my localtime file indicated in the compose file

  ntopng:
    container_name: ntopng
    image: 'docker.io/ntop/ntopng:stable'
    restart: always
    depends_on:
      - clickhouse
      - redis
      - nprobe
      - influxdb
    volumes:
      - "/usr/share/zoneinfo:/usr/share/zoneinfo:ro"
      - "/etc/localtime:/etc/localtime:ro"
      - "/opt/ntopng/ntopng.license:/etc/ntopng.license:ro"
      - "/opt/ntopng/ntopng/config:/etc/ntopng:rw"
      - "/opt/ntopng/ntopng/data:/var/lib/ntopng:rw"
    environment:
      - NTOP_CONFIG="/etc/ntopng/ntopng.conf"
      - TZ="Europe/Zurich"
    network_mode: "host"
    command:
      - "/etc/ntopng/ntopng.conf"

How did you reproduce it?

Modify the compose file and restart the compose with command docker compose up -d

Debug Information:

With this configuration, I have that on the shell:

dadmrossetam:ntopng/ $ sudo docker exec -ti ntopng /bin/sh
# ls -al /etc/localtime
lrwxrwxrwx 1 root root 23 May 31 15:35 /etc/localtime -> /usr/share/zoneinfo/UTC
#

I think the issue is related to the following part that is present in stable Dockerfile:

FROM ubuntu:22.04
MAINTAINER ntop.org

ENV TZ=UTC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

RUN apt-get update && \
    apt-get -y -q install wget lsb-release gnupg libelf1 && \

So, even if I try to override it, it can not work...