Communication between container running in network_mode: host and other containers running on internal network

136 views
Skip to first unread message

Sergey Geyhman

unread,
Jul 28, 2021, 6:10:26 AM7/28/21
to Prometheus Users

Hello,


I'm running Prometheus node_exporter in network_mode=host, the reason is to monitor all NW interfaces.

All other containers (including Prometheus) are running on dedicated NW (net)

the problem - port of node_exporter container is not reachable from other containers  


ping from Prometheus container to IP that node_exporter has is working fine


```

ping 172.31.0.1

PING 172.31.0.1 (172.31.0.1): 56 data bytes

64 bytes from 172.31.0.1: seq=0 ttl=64 time=0.086 ms

64 bytes from 172.31.0.1: seq=1 ttl=64 time=0.091 ms

```


when wget is failing


```

wget 172.31.0.1:9194

Connecting to 172.31.0.1:9194 (172.31.0.1:9194)

wget: can't connect to remote host (172.31.0.1): Operation timed out

```


of cause from the host everything is working fine 


```

wget 172.31.0.1:9194

--2021-07-28 09:22:14--  http://172.31.0.1:9194/

Connecting to 172.31.0.1:9194... connected.

HTTP request sent, awaiting response... 200 OK

```


 

Prometheus container interfaces 


```

eth0      Link encap:Ethernet  HWaddr 02:42:AC:1F:00:02  

          inet addr:172.31.0.2  Bcast:172.31.0.255  Mask:255.255.255.0

```


Node exporter container interfaces 


```

br-1ad4556bf2df Link encap:Ethernet  HWaddr 02:42:05:50:9F:FA  

          inet addr:172.31.0.1  Bcast:172.31.0.255  Mask:255.255.255.0

          inet6 addr: fe80::42:5ff:fe50:9ffa/64 Scope:Link


docker0   Link encap:Ethernet  HWaddr 02:42:EA:A0:83:0B  

          inet addr:172.17.0.1  Bcast:172.17.255.255  Mask:255.255.0.0

          UP BROADCAST MULTICAST  MTU:1500  Metric:1


ens4      Link encap:Ethernet  HWaddr 42:01:0A:84:00:0B  

          inet addr:10.132.0.11  Bcast:0.0.0.0  Mask:255.255.255.255

```

  

from docker-compose


```

  prometheus_node_exporter:

    network_mode: host

    command:

      - '--web.listen-address=:9194'

..........................

  prometheus:

    networks:

        - net

...............................

networks:

    net:

        ipam:

            driver: default

            config:

                - subnet: 172.31.0.0/24

```



any ideas?

Ian Billett

unread,
Jul 29, 2021, 11:27:59 AM7/29/21
to Sergey Geyhman, Prometheus Users
Hey Sergey,

I'm afraid that sounds like a docker networking problem, this mailing list is focused on the prometheus server itself so you would be lucky to find someone with the answer :)

Best,

Ian

--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/27f7b92a-ffd8-43d4-9b63-da7a54bcaca7n%40googlegroups.com.

Sergey Geyhman

unread,
Aug 1, 2021, 2:18:47 AM8/1/21
to Prometheus Users
thanks, i will try to find answer in docker community 
Reply all
Reply to author
Forward
0 new messages