From ac4600cec97a0c4b29f1b613aa2355ae6694c96a Mon Sep 17 00:00:00 2001 From: jon r Date: Fri, 11 Oct 2024 15:35:24 +0200 Subject: [PATCH] docs(docker): explain how to persist DNS configuration --- docs/developer/setup/docker.md | 39 +++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/docs/developer/setup/docker.md b/docs/developer/setup/docker.md index 6566fae98..894e83830 100644 --- a/docs/developer/setup/docker.md +++ b/docs/developer/setup/docker.md @@ -116,7 +116,44 @@ Then run the network services to access the running containers. sudo resolvectl domain docker0 '~funkwhale.test.' ``` - Please refer to the manual of your distribution for other configurations. + This is a temporary setting that will be lost after a reboot. + + A superuser of the system can persist this setting by providing a + systemd service that `BindsTo=` the `docker0` device. This requires `sudo` + privilege. + + ```sh + sudo sh -c "umask 133; tee /etc/systemd/system/funkwhale-dns-docker0.service" <<< "[Unit] + Description=Funkwhale per-link DNS configuration for docker0 + BindsTo=sys-subsystem-net-devices-docker0.device + After=sys-subsystem-net-devices-docker0.device + + [Service] + Type=oneshot + ExecStart=/usr/bin/resolvectl dns docker0 172.17.0.1 + ExecStart=/usr/bin/resolvectl domain docker0 '~funkwhale.test.' + ExecStopPost=/usr/bin/resolvectl revert docker0 + RemainAfterExit=yes + + [Install] + WantedBy=sys-subsystem-net-devices-docker0.device + " + sudo systemctl daemon-reload + sudo systemctl enable --now funkwhale-dns-docker0.service + ``` + + This gives you a systemd unit, whose life cycle is bound to the `docker0` + network device. + + ```sh + systemctl status \ + funkwhale-dns-docker0.service \ + sys-subsystem-net-devices-docker0.device + ``` + + Please refer to the manual of your distribution for other configurations, + e.g. with system installations of netplan, systemd-networkd, NetworkManager, resolvconf or dnsmasq. Ensure the search domain is set to `funkwhale.test.` + and the nameserver address is set to `172.17.0.1`. :::