Fix kiwix ZIM volume mount to work with a symlink
CI / check (push) Successful in 1m7s
CI / deploy (push) Successful in 14s

Bind-mounting data/kiwix/ (the directory) meant a symlink placed
inside it broke: the container has to resolve that symlink itself,
in its own filesystem, where the host path it points to doesn't
exist. Binding the exact data/kiwix/wikipedia.zim file path instead
resolves it on the host at mount time (plain mount(2) semantics), so
the real ZIM can live anywhere on the host without duplicating a
multi-GB file into this repo's data/ directory.
This commit is contained in:
randy committed 2026-09-09 14:01:39 +02:00
1 parent 24ac5931f8
commit c66ae8d2d0
2 files changed
+18 -2

No files matched your search

+10 -1
View File
@@ -60,9 +60,18 @@ services:
# service's own name), so maptool and kiwix stay independent containers.
# Keeps restarting (harmlessly) if data/kiwix/wikipedia.zim isn't there
# yet — GET /api/kiwix just reports unavailable until it comes up.
#
# The volume binds the exact *file* path, not the data/kiwix/ directory —
# deliberately, so data/kiwix/wikipedia.zim can be a symlink to wherever
# the (large) real ZIM actually lives. A bind mount resolves a symlink at
# its *source* path once, at mount time (plain mount(2) semantics, same
# as Podman); a symlink sitting inside an already-mounted directory
# doesn't get that treatment — the container would have to resolve it
# itself, inside its own filesystem, where the host path it points to
# doesn't exist.
kiwix:
image: ghcr.io/kiwix/kiwix-serve:latest
restart: unless-stopped
command: ["--port=8080", "/data/wikipedia.zim"]
volumes:
- ./data/kiwix:/data
- ./data/kiwix/wikipedia.zim:/data/wikipedia.zim