docker-compose v1 cannot clear the ports list from the base compose with ports: [] in an override, so network_mode: host caused InvalidArgument. Use extra_hosts with host-gateway instead: maps 'mosquitto' hostname to the Docker bridge gateway IP so mqtt://mosquitto:1883 reaches the host-networked mosquitto process from within the bridge-networked z2m container. Requires Docker 20.10+ (present on chelsty-infra). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
21 lines
846 B
YAML
21 lines
846 B
YAML
services:
|
|
zigbee2mqtt:
|
|
# mosquitto runs with network_mode: host on chelsty-infra.
|
|
# extra_hosts maps the 'mosquitto' hostname to the host gateway IP so that
|
|
# mqtt://mosquitto:1883 in configuration.yaml reaches the host-networked
|
|
# mosquitto process. Works with docker-compose v1 (docker 20.10+).
|
|
extra_hosts:
|
|
- "mosquitto:host-gateway"
|
|
volumes:
|
|
# configuration.yaml lives in the runtime config dir (not in Git).
|
|
# On chelsty-infra: /opt/homelab/config/zigbee2mqtt/configuration.yaml
|
|
- /opt/homelab/config/zigbee2mqtt/configuration.yaml:/app/data/configuration.yaml:ro
|
|
environment:
|
|
- TZ=Europe/Warsaw
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "wget -qO- http://localhost:8080 > /dev/null 2>&1 || exit 1"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 60s
|