[FEAT] environment variable(s) to override DNS servers (essential in host network mode, e.g. TrueNAS Apps + Pi-hole setups)

Aperta
#330 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
51/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
docker
Ambito
devops

Direzione di ricerca

Read the container init scripts that currently configure /etc/resolv.conf and compare their environment variable handling with the WHITELIST and HOST_WHITELIST pattern referenced in issues #146 and #141. Identify how startup preserves current behavior when the new variables are unset, then add coverage for the configured and unset cases. Done means the requested DNS values are applied before the service starts and existing behavior remains unchanged when they are absent.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement
Is this a new feature request?
  • I have searched the existing issues
Wanted change

Add support for one or two environment variables that override the DNS servers of the container, applied by the init system before the service starts:

DNS_SERVERS=192.168.1.1,1.1.1.1   # comma-separated list of nameservers
DNS_OPTIONS=attempts:2 timeout:2  # optional extra resolv.conf options

When set, the init writes /etc/resolv.conf with these values. When unset, behavior stays exactly as today (fully backward-compatible).
This follows the same pattern as the previously accepted WHITELIST / HOST_WHITELIST env vars (#146, #141).

Reason for change

The app is commonly deployed through GUI-based app managers (TrueNAS SCALE Apps / iX Apps), where the template uses network_mode: host and users have no access to docker run / compose options like --dns.

A very common home-lab pattern on such hosts is a network-wide filtering/validating resolver (Pi-hole with DNSSEC) on the same machine, used by every host and container. This is desirable for everything except a torrent client: Transmission resolves dozens of tracker domains on every announce (every ~30 min per tracker), many of them dead or with broken DNSSEC signatures, generating constant retries. A single torrent client ends up flooding the resolver's statistics and logs, drowning out all other devices in the dashboard.

Routing only Transmission to another resolver (e.g. the ISP box) while the rest of the host keeps the local resolver requires overwriting /etc/resolv.conf inside the container at every start. Today this needs an undocumented, fragile hand-made init script, impossible to configure from the TrueNAS app GUI.

With --network host, Docker itself ignores --dns, so there is no native Docker mechanism to give this one container different DNS servers. An env var is the only clean way for GUI users.

The same need applies to other LSIO images commonly run in host mode through app managers (qBittorrent, Deluge, SABnzbd...), so a generic implementation would benefit the whole fleet.

Proposed code change

No response

Lingua principale
Dockerfile
Stelle
743
Fork
206
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Issue simili

Altre issue su DevOps

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.