PODMAN: Container kann nicht auf Datei zugreifen

Hallo,

ich verwende Podman rootless in der Version 5.6.1 unter Fedora.

Ich wollte mir auf dem Heimserver auch SearXNG installieren. Leider bekomme ich es nicht hin, dass dass der Container die settings.yml des Hosts lesen kann. Der Benutzer und die Gruppe auf dem System und dem Container sind ungleich.

$ls -l settings.yml 
-rw-r--r--. 1 pod pod 70127 Sep 30 09:06 settings.yml

Den Container starte ich mit

podman run \
  --name searxng \
  -p 0.0.0.0:5234:8080 \
  -e SEARXNG_BASE_URL=http://192.168.4.15:5234/ \
  -e SEARXNG_SECRET=123456 \
  --userns=keep-id \
  --user=$(id -u):$(id -g) \
  -v /opt/podman/searxng/config:/etc/searxng \
  searxng/searxng:latest

Der Container kann aber nicht die settings.yml lesen

!!!
!!! WARNING
!!! "/etc/searxng" directory is not owned by "searxng:searxng"
!!! This may cause issues when running SearXNG
!!!
!!! Expected "searxng:searxng"
!!! Got "podi:podi"
!!!
!!!
!!! WARNING
!!! "/etc/searxng/settings.yml" file is not owned by "searxng:searxng"
!!! This may cause issues when running SearXNG
!!!
!!! Expected "searxng:searxng"
!!! Got "pod:pod"
!!!
Failed to open temporary file /etc/ssl/certs/bundleXXXXXX for ca bundle
[WARNING] Configuration allows spawning up to 4 Python threads, which seems quite high compared to the number of CPU cores available. Consider reviewing your configuration and using `backpressure` to limit the concurrency on the Python interpreter. If this configuration is intentional, you can safely ignore this message.
[INFO] Starting granian (main PID: 1)
[INFO] Listening at: http://:::8080
[INFO] Spawning worker-1 with PID: 11
2025-09-30 10:08:23,681 ERROR:searx.engines: Missing engine config attribute: "yacy images.base_url"
2025-09-30 10:08:23,707 WARNING:searx.search.processors: Engine of name 'ahmia' does not exists.

Wie kann ich den Container ermächtigen die Datei einzulesen? Hat jemand ein Tipp?

Ich muss gestehen, dass ich mit Podman ein Neuling bin. Unter Docker mit root war es immer keine Problem :grin:

Ich konnte das Problem lösen. Ich habe alles noch einmal von vorne eingerichtet und den Aufruf entsprechend abgeändert.

$sudo mkdir -p /opt/podman/searxng/{config,data}
$sudo chown -R podi:podi /opt/podman/searxng/
$podman rm -f searxng 2>/dev/null || true
$podman run   --name searxng   -p 0.0.0.0:5234:8080   -e SEARXNG_BASE_URL=http://192.168.4.15:5234/   -e SEARXNG_SECRET=dfsj323qjwkjqfjadkj   --uidmap +$(id -u):977:1 --gidmap +$(id -g):977:1     --user=0:0   -v /opt/podman/searxng/config:/etc/searxng:Z   ghcr.io/searxng/searxng:latest

Neu ist

-uidmap +$(id -u):977:1 --gidmap +$(id -g):977:1     --user=0:0

Da warst du tatsächlich ein paar Minuten schneller. Ich wollte gerade antworten. Ich bin auch nicht der Podman-Profi, aber beschäftige mich aktuell damit.

Ich glaube das der wichtige „neue“ Teil das :Z am Ende des Volume ist. Ich habe es mal anhand eines Minimalbeispiel getestet:

nick@fedora:/opt/podman/searxng$ id
uid=1000(nick) gid=1000(nick) Gruppen=1000(nick),10(wheel) Kontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023

nick@fedora:/opt/podman/searxng$ ls -lA
insgesamt 0
drwxr-xr-x. 2 nick nick 6  3. Okt 14:35 config
drwxr-xr-x. 2 nick nick 6  3. Okt 14:30 data
podman run --name searxng -v /opt/podman/searxng/config:/etc/searxng searxng/searxng:latest
SearXNG 2025.10.3-cdf5f4343
chown: /etc/searxng: Permission denied
chown: /etc/searxng: Permission denied
...
... INFORMATION
... "/etc/searxng/settings.yml" does not exist, creating from template...
...
cp: can't create '/etc/searxng/settings.yml': Permission denied
sed: /etc/searxng/settings.yml: No such file or directory
!!!
!!! ERROR
!!! "/etc/searxng/settings.yml" is not a valid file, exiting...
!!!
podman run --name searxng -v /opt/podman/searxng/config:/etc/searxng:Z searxng/searxng:latest
SearXNG 2025.10.3-cdf5f4343
...
... INFORMATION
... "/etc/searxng/settings.yml" does not exist, creating from template...
...
[INFO] Starting granian (main PID: 1)
[INFO] Listening at: http://:::8080
[INFO] Spawning worker-1 with PID: 16
2025-10-03 12:38:52,538 ERROR:searx.engines: Missing engine config attribute: "yacy images.base_url"
2025-10-03 12:38:52,594 WARNING:searx.search.processors: Engine of name 'ahmia' does not exists.
2025-10-03 12:38:52,620 WARNING:searx.search.processors: Engine of name 'torch' does not exists.
2025-10-03 12:38:52,628 WARNING:searx.search.processors: Engine of name 'yacy images' does not exists.
2025-10-03 12:38:52,632 WARNING:searx.botdetection.config: missing config file: /etc/searxng/limiter.toml
[INFO] Started worker-1
[INFO] Started worker-1 runtime-1

Kann sein, dass es im ersten Beispiel ein SE-Linux Problem war.

1 „Gefällt mir“

Ich glaube auch, dass es mit SE-Linux Probleme gab. Ich nutze Fedora und podman 5.6.2. Fedora nutzt wohl Linux SE. Nur das Z hat aber aber auch nicht funktioniert. Mit dem neu anlegen und den Rechten hat es dann aber doch funktioniert. Vielen Dank!