I have a container which listens to all interfaces(0.0.0.0) on port 6060, it operates on the host network using the network_mode: host
rule.
When I try to access it using Prometheus with this config:
- job_name: 'server'
metrics_path: /debug/metrics/prometheus
static_configs:
- targets: ['server:6060']
I get a "context deadline exceeded" error in Prometheus logs, which isn't really saying much.
I've tried extra_hosts: - server:host-gateway
in the compose file with no avail.
Only when I do the same but with no host networking and only bridge networks it works fine, but I want to leave it on due to performance issues.
Is there any workaround or solution for this?
question from:
https://stackoverflow.com/questions/65545560/how-can-i-access-a-container-on-the-host-network-with-a-bridged-container 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…