A container running its own avahi-daemon collides with the host's on :5353. Instead publish to the host avahi over its mounted D-Bus socket using avahi-tools (avahi-publish). Needs apparmor=unconfined (docker-default blocks the D-Bus publish). Documented host prereqs incl. allow-interfaces for multi-bridge hosts. Tested: publish reaches host avahi and registers the names; on hosts with many docker bridges avahi self-collides until restricted to the LAN interface. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
29 lines
1.1 KiB
YAML
29 lines
1.1 KiB
YAML
# mDNS toggle — publish *.local service names via the HOST's avahi-daemon for
|
|
# zero-config guest resolution. Enabled when ENABLE_MDNS=true in .env and only
|
|
# meaningful when BASE_DOMAIN=*.local.
|
|
#
|
|
# Host prerequisites:
|
|
# - avahi-daemon running on the host
|
|
# - if the host has many interfaces (e.g. lots of docker bridges), restrict
|
|
# avahi to the LAN NIC in /etc/avahi/avahi-daemon.conf:
|
|
# allow-interfaces=<lan-iface>
|
|
# otherwise avahi sees its own announcements across bridges → "Local name
|
|
# collision" and publishing fails.
|
|
services:
|
|
avahi:
|
|
build: ./docker/avahi
|
|
image: ulicraft-avahi:local
|
|
container_name: avahi
|
|
restart: unless-stopped
|
|
network_mode: host
|
|
# AppArmor's docker-default profile blocks the D-Bus publish to host avahi.
|
|
security_opt:
|
|
- apparmor=unconfined
|
|
environment:
|
|
BASE_DOMAIN: ${BASE_DOMAIN}
|
|
HOST_LAN_IP: ${HOST_LAN_IP}
|
|
DBUS_SYSTEM_BUS_ADDRESS: "unix:path=/run/dbus/system_bus_socket"
|
|
volumes:
|
|
# Talk to the host's avahi-daemon (host must run avahi-daemon).
|
|
- /run/dbus/system_bus_socket:/run/dbus/system_bus_socket
|