Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
454 views
in Technique[技术] by (71.8m points)

docker - How can I access a container on the host network with a bridged container?

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...