diff options
author | nicolargo <nicolas@nicolargo.com> | 2023-03-05 09:25:53 +0100 |
---|---|---|
committer | nicolargo <nicolas@nicolargo.com> | 2023-03-05 09:25:53 +0100 |
commit | 6b637bcc57b2a97e2de216784a5159b1b2307db6 (patch) | |
tree | a89004123104e11630a88d0c8e739fb2994c8594 | |
parent | 69be665406d0ebd7a715df3a23143f6e253f3ca1 (diff) |
All times displayed in UTC - Container not using TZ/localtime (Docker) #2278
-rw-r--r-- | Makefile | 12 | ||||
-rw-r--r-- | README.rst | 6 | ||||
-rw-r--r-- | docker-compose/docker-compose-with-traefik.yml | 6 | ||||
-rw-r--r-- | docker-compose/docker-compose.yml | 9 | ||||
-rw-r--r-- | docker-files/alpine.Dockerfile | 6 | ||||
-rw-r--r-- | docker-files/ubuntu.Dockerfile | 2 |
6 files changed, 24 insertions, 17 deletions
@@ -159,22 +159,22 @@ run-local-conf: ## Start Glances in console mode with the system conf file ./venv/bin/python -m glances run-docker-alpine-minimal: ## Start Glances Alpine Docker minimal in console mode - docker run --rm -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host --network host -it glances:local-alpine-minimal + docker run --rm -e TZ="${TZ}" -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host --network host -it glances:local-alpine-minimal run-docker-alpine-full: ## Start Glances Alpine Docker full in console mode - docker run --rm -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host --network host -it glances:local-alpine-full + docker run --rm -e TZ="${TZ}" -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host --network host -it glances:local-alpine-full run-docker-alpine-dev: ## Start Glances Alpine Docker dev in console mode - docker run --rm -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host --network host -it glances:local-alpine-dev + docker run --rm -e TZ="${TZ}" -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host --network host -it glances:local-alpine-dev run-docker-ubuntu-minimal: ## Start Glances Ubuntu Docker minimal in console mode - docker run --rm -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host --network host -it glances:local-ubuntu-minimal + docker run --rm -e TZ="${TZ}" -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host --network host -it glances:local-ubuntu-minimal run-docker-ubuntu-full: ## Start Glances Ubuntu Docker full in console mode - docker run --rm -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host --network host -it glances:local-ubuntu-full + docker run --rm -e TZ="${TZ}" -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host --network host -it glances:local-ubuntu-full run-docker-ubuntu-dev: ## Start Glances Ubuntu Docker dev in console mode - docker run --rm -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host --network host -it glances:local-ubuntu-dev + docker run --rm -e TZ="${TZ}" -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host --network host -it glances:local-ubuntu-dev run-webserver: ## Start Glances in Web server mode ./venv/bin/python -m glances -C ./conf/glances.conf -w @@ -220,7 +220,7 @@ Run last version of Glances container in *console mode*: .. code-block:: console - docker run --rm -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host --network host -it nicolargo/glances:latest-full + docker run --rm -e TZ="${TZ}" -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host --network host -it nicolargo/glances:latest-full Additionally, if you want to use your own glances.conf file, you can create your own Dockerfile: @@ -237,7 +237,7 @@ variable setting parameters for the glances startup command): .. code-block:: console - docker run -v `pwd`/glances.conf:/etc/glances.conf -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host -e GLANCES_OPT="-C /etc/glances.conf" -it nicolargo/glances:latest-full + docker run -e TZ="${TZ}" -v `pwd`/glances.conf:/etc/glances.conf -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host -e GLANCES_OPT="-C /etc/glances.conf" -it nicolargo/glances:latest-full Where \`pwd\`/glances.conf is a local directory containing your glances.conf file. @@ -245,7 +245,7 @@ Run the container in *Web server mode*: .. code-block:: console - docker run -d --restart="always" -p 61208-61209:61208-61209 -e GLANCES_OPT="-w" -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host nicolargo/glances:latest-full + docker run -d --restart="always" -p 61208-61209:61208-61209 -e TZ="${TZ}" -e GLANCES_OPT="-w" -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host nicolargo/glances:latest-full GNU/Linux --------- diff --git a/docker-compose/docker-compose-with-traefik.yml b/docker-compose/docker-compose-with-traefik.yml index db29890f..786aa905 100644 --- a/docker-compose/docker-compose-with-traefik.yml +++ b/docker-compose/docker-compose-with-traefik.yml @@ -21,9 +21,11 @@ services: privileged: true network_mode: "host" volumes: - - /var/run/docker.sock:/var/run/docker.sock + - "/var/run/docker.sock:/var/run/docker.sock:ro" + - "./glances.conf:/glances/conf/glances.conf" environment: - - "GLANCES_OPT=-w" + - GLANCES_OPT: "-C /glances/conf/glances.conf -w" + - TZ: "${TZ}" labels: - "traefik.port=61208" - "traefik.frontend.rule=Host:glances.docker.localhost" diff --git a/docker-compose/docker-compose.yml b/docker-compose/docker-compose.yml index acf17cbe..703d8775 100644 --- a/docker-compose/docker-compose.yml +++ b/docker-compose/docker-compose.yml @@ -5,11 +5,12 @@ services: context: ./ dockerfile: Dockerfile restart: always + pid: "host" + privileged: true network_mode: "host" - environment: - GLANCES_OPT: "-C /glances/conf/glances.conf -w" volumes: - "/var/run/docker.sock:/var/run/docker.sock:ro" - "./glances.conf:/glances/conf/glances.conf" - pid: "host" - privileged: true + environment: + - GLANCES_OPT: "-C /glances/conf/glances.conf -w" + - TZ: "${TZ}" diff --git a/docker-files/alpine.Dockerfile b/docker-files/alpine.Dockerfile index 3a4b64ef..53e78f47 100644 --- a/docker-files/alpine.Dockerfile +++ b/docker-files/alpine.Dockerfile @@ -27,7 +27,8 @@ RUN apk add --no-cache \ lm-sensors \ wireless-tools \ smartmontools \ - iputils + iputils \ + tzdata ############################################################################## # Install the dependencies beforehand to make them cacheable @@ -95,7 +96,8 @@ RUN apk add --no-cache \ lm-sensors \ wireless-tools \ smartmontools \ - iputils + iputils \ + tzdata COPY --from=buildRequirements /root/.local/bin /usr/local/bin/ COPY --from=buildRequirements /root/.local/lib/python${PYTHON_VERSION}/site-packages /usr/lib/python${PYTHON_VERSION}/site-packages/ diff --git a/docker-files/ubuntu.Dockerfile b/docker-files/ubuntu.Dockerfile index 22394169..2fa00d27 100644 --- a/docker-files/ubuntu.Dockerfile +++ b/docker-files/ubuntu.Dockerfile @@ -27,6 +27,7 @@ RUN apt-get update \ wireless-tools \ smartmontools \ net-tools \ + tzdata \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* @@ -105,6 +106,7 @@ RUN apt-get update \ wireless-tools \ smartmontools \ net-tools \ + tzdata \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* |