Fix nginx-exporter: back to bridge network with host.docker.internal

host network mode prevented Prometheus from reaching the exporter.
Switched back to bridge with extra_hosts + explicit port mapping.
Added timeout flag to prevent hanging on stub_status fetch.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
justin 2026-05-01 03:21:27 -05:00
parent 433827138b
commit 0a31313956
2 changed files with 7 additions and 3 deletions

View file

@ -374,8 +374,12 @@ services:
nginx-exporter:
image: nginx/nginx-prometheus-exporter:latest
command:
- -nginx.scrape-uri=http://127.0.0.1:8888/nginx_status
network_mode: host
- -nginx.scrape-uri=http://host.docker.internal:8888/nginx_status
- -nginx.timeout=5s
extra_hosts:
- "host.docker.internal:host-gateway"
ports:
- "127.0.0.1:9113:9113"
restart: unless-stopped
blackbox-exporter: