vladgh / docker_base_images

Vlad's Base Images for Docker
Apache License 2.0
86 stars 39 forks source link

Failed to set TZ, due to tzdata missing from image #296

Open dittodhole opened 1 month ago

dittodhole commented 1 month ago

Hi, and thanks for this sleek docker image ❤️

When setting env TZ to eg Europe/Vienna the container fails to start, as the timezone is missing. I've also tried to utilize command: bash -c "apk add tzdata", but this fails in minidlna.c:830.

Any chance to add tzdata to https://github.com/vladgh/docker_base_images/blob/main/minidlna/Dockerfile#L7?

Best Andreas

vladgh commented 1 month ago

HI Andreas, I cannot replicate this. Seems to work fine. Alpine has it's own tzdata scripts, called by this image at the beginning, and as long as the time zone is a string that exists in the database, it should work. May I ask how are you defining the env?

dittodhole commented 1 month ago
services:
  minidlna:
    container_name: minidlna
    image: vladgh/minidlna
    restart: unless-stopped
    hostname: minidlna
    environment:
      TZ: Europe/Vienna
      PUID: 1000
      PGID: 1000
      MINIDLNA_MEDIA_DIR_1: A,/mnt/music
      MINIDLNA_FRIENDLY_NAME: minidlna
    volumes:
      - type: bind
        source: /media/music
        target: /mnt/music
        read_only: true

Output of the container:

=== Set user and group identifier === Set timezone 'Europe/Vienna' is not a valid timezone on this system

I even consoled into the container, to list the available timezones:

minidlna:/# cat /etc/os-release NAME="Alpine Linux" ID=alpine VERSION_ID=3.20.0_alpha20240315 PRETTY_NAME="Alpine Linux edge" HOME_URL="https://alpinelinux.org/" BUG_REPORT_URL="https://gitlab.alpinelinux.org/alpine/aports/-/issues" minidlna:/# ls /usr/share/zoneinfo ls: /usr/share/zoneinfo: No such file or directory

vladgh commented 1 month ago

That exact compose file gives me:

=== Set user and group identifier
=== Set timezone
=== Set standard configuration
=== Set configuration from environment variables
=== Set permissions
=== Generate scan/rebuild flags
=== Start daemon
minidlna.c:1134: warn: Starting MiniDLNA version 1.3.3.
minidlna.c:394: warn: Creating new database at /minidlna/cache/files.db
minidlna.c:1182: warn: HTTP listening on port 8200
playlist.c:135: warn: Parsing playlists...
playlist.c:269: warn: Finished parsing playlists.

The only thing I can think of is to do a docker pull vladgh/minidlna:latest maybe you have a really old version of my image, before it had time zone support.

dittodhole commented 1 month ago

Nope, still same error 😢

root@hub:~# docker pull vladgh/minidlna:latest latest: Pulling from vladgh/minidlna Digest: sha256:2ea56318ab506eb7e85beda4be4c1f6013341946674252d98764f2372e083681 Status: Image is up to date for vladgh/minidlna:latest docker.io/vladgh/minidlna:latest

vladgh commented 1 month ago

And they said Docker will eliminate the "It works on my computer" problem 😡

I will look into it some more, but for now, I'm not sure what to tell you.

dittodhole commented 1 month ago

Thanks for your assistance! Really appreciate it ❤️

Is there anything I can fiddle around to give you a better insight "on my machine"?

vladgh commented 1 month ago

Remove the image completely, all versions, and pull it again. Maybe try to run it somewhere else, a different VM or machine.

dittodhole commented 1 month ago

Thanks for the suggestions, I did so with my current setup - but did not help.

root@hub:~# cat /proc/version
Linux version 6.1.43-rockchip-rk3588 (root@orangepi5) (aarch64-linux-gnu-gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, GNU ld (GNU Binutils for Ubuntu) 2.38) #1.0.8 SMP Sat Feb  3 00:04:38 CST 2024
root@hub:~# cat /etc/*-release
# PLEASE DO NOT EDIT THIS FILE
BOARD=orangepi5plus
BOARD_NAME="Orange Pi 5 Plus"
BOARDFAMILY=rockchip-rk3588
BUILD_REPOSITORY_URL=
BUILD_REPOSITORY_COMMIT=
DISTRIBUTION_CODENAME=bookworm
DISTRIBUTION_STATUS=
VERSION=1.0.8
LINUXFAMILY=rockchip-rk3588
ARCH=arm64
IMAGE_TYPE=user-built
BOARD_TYPE=conf
INITRD_ARCH=arm64
KERNEL_IMAGE_TYPE=Image
BRANCH=current
IMAGE_UUID=82485bdf-1923-4b37-bce6-eb3b12909f99
# PLEASE DO NOT EDIT THIS FILE
BOARD=orangepi5plus
BOARD_NAME="Orange Pi 5 Plus"
BOARDFAMILY=rockchip-rk3588
BUILD_REPOSITORY_URL=
BUILD_REPOSITORY_COMMIT=
DISTRIBUTION_CODENAME=bookworm
DISTRIBUTION_STATUS=
VERSION=1.0.8
LINUXFAMILY=rockchip-rk3588
ARCH=arm64
IMAGE_TYPE=user-built
BOARD_TYPE=conf
INITRD_ARCH=arm64
KERNEL_IMAGE_TYPE=Image
BRANCH=current
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
root@hub:~# hostnamectl
 Static hostname: hub
       Icon name: computer
      Machine ID: 4b7396752ce94cf89c04f5c327db73bd
         Boot ID: a289451af9ef4be3a07eb5a1336328c9
Operating System: Debian GNU/Linux 12 (bookworm)
          Kernel: Linux 6.1.43-rockchip-rk3588
    Architecture: arm64

Anyway, I just mounted /usr/share/zoneinfo, which fixed the problem:

services:
  minidlna:
    container_name: minidlna
    image: vladgh/minidlna
    restart: unless-stopped
    hostname: minidlna
    environment:
      TZ: Europe/Vienna
      PUID: 1000
      PGID: 1000
      MINIDLNA_MEDIA_DIR_1: A,/mnt/music
      MINIDLNA_FRIENDLY_NAME: minidlna
    volumes:
      - type: bind
        source: /media/music
        target: /mnt/music
        read_only: true
      - type: bind
        source: /usr/share/zoneinfo
        target: /usr/share/zoneinfo
        read_only: true

=== Set user and group identifier === Set timezone === Set standard configuration === Set configuration from environment variables === Set permissions === Generate scan/rebuild flags === Start daemon minidlna.c:1134: warn: Starting MiniDLNA version 1.3.3. minidlna.c:394: warn: Creating new database at /minidlna/cache/files.db minidlna.c:1182: warn: HTTP listening on port 8200 scanner.c:731: warn: Scanning /mnt/music

dittodhole commented 3 weeks ago

fyi - when running network_mode: host instead of attaching the container to a macvlan, the tzdata package gets installed.