Container read host /proc/net/dev


I’d like to build a container that reads the host’s OS /proc/net/dev file for monitoring.

The container itself has it’s own /proc/net/dev file already though.

I’m thinking the correct approach would be to bind the host /proc/net/dev to something like /host/proc/net/dev in the container, then have the application code use that file.


sudo docker run --rm -it -v /proc/net/dev:/host/proc/net/dev ubuntu:latest bash

Do you think this is the correct approach?


I’m struggling with the same issue for the titpetric/netdata container, so far the only way is to run the container with --net=host. I’m looking at --cap-add options to see if there’s a way to elevate these permissions from the host, but so far I’m not having any success. At least i know the NET_ADMIN capability doesn’t work :slight_smile: