Netdata Community

Netdata in Docker cannot see traffic of other Containers

Hello,

iam running netdata in docker with docker-compose. Host metrics seems to be fine but i cannot see the traffic of other containers running on the same host. The Netdata documentation speaks about not showing the docker container names properly (which is not an issue for me, i dont care about the names) so therefore i considert this section not as relevant.

However i tried also the solution suggested there using a proxy. The name of the containers are shown now, however traffic seems be be still not shown.

I tested the following two docker-compose configurations:

  1. Without Docker container names:

     version: '3'
         services:
           netdata:
             image: netdata/netdata
             container_name: netdata
             hostname: hostname1 # set to fqdn of host
             ports:
               - 19999:19999
             restart: unless-stopped
             cap_add:
               - SYS_PTRACE
             security_opt:
               - apparmor:unconfined
             volumes:
               - ./netdataconfig/netdata:/etc/netdata
               - netdatalib:/var/lib/netdata
               - netdatacache:/var/cache/netdata
               - /etc/passwd:/host/etc/passwd:ro
               - /etc/group:/host/etc/group:ro
               - /proc:/host/proc:ro
               - /sys:/host/sys:ro
               - /etc/os-release:/host/etc/os-release:ro
         environment:
           - VIRTUALIZATION:xen
         volumes:
           netdataconfig:
           netdatalib:
           netdatacache: 
    
  2. with proxy as defined in the documentation

     version: '3'
     services:
       proxy:
         image: tecnativa/docker-socket-proxy
         volumes:
          - /var/run/docker.sock:/var/run/docker.sock:ro
         environment:
           - CONTAINERS=1
       netdata:
         image: netdata/netdata
         container_name: netdata
         hostname: hostname1 # set to fqdn of host
         ports:
           - 19999:19999
         restart: unless-stopped
         cap_add:
           - SYS_PTRACE
         security_opt:
           - apparmor:unconfined
         volumes:
           - ./netdataconfig/netdata:/etc/netdata
           - netdatalib:/var/lib/netdata
           - netdatacache:/var/cache/netdata
           - /etc/passwd:/host/etc/passwd:ro
           - /etc/group:/host/etc/group:ro
           - /proc:/host/proc:ro
           - /sys:/host/sys:ro
           - /etc/os-release:/host/etc/os-release:ro
         environment:
           - DOCKER_HOST=proxy:2375
        - VIRTUALIZATION:xen
     volumes:
       netdataconfig:
       netdatalib:
       netdatacache:
    

I also tried running Netdata natively on the host and it worked fine, container traffic was show properly.

Environment

Docker on Ubuntu 20.10

Problem/Question

i would like to run Netdata in docker as well and still be able to monitor the other containers properly

What I expected to happen

RUn Netdata in a docker container and still show all data from other containers as well as the host

So a solution to anyone who might have the same problem. My machines have hardening scripts installed per default. The setting: “hidepid” was set to “2” which disables the container to see the other processes. It works if you run the container with root but not if you go via the more secure way of using the docker proxy. So you have to enable the user running the netdata container to see the other processes (setting “hidepid” to “0”).

1 Like