I'm trying to figure out how to track bandwidth coming from a Docker container.
Normally I use --uid-owner
as mark to keep track of bandwidth usage for a given user. However, even when I run all the processes as the user inside the docker container --uid-owner
is not working. Instead of using --uid-owner
, I tried just tracking all packets coming from the virtual ethernet device that docker creates.
This, however, ended up doing nothing too: no matter what I try, no packets are being caught.
Out of sheer desperation, I tried just putting the rules in all the chains but had no result neither.
Chain PREROUTING (policy ACCEPT 3041 packets, 7849454 bytes)
num pkts bytes target prot opt in out source destination
1 0 0 MARK tcp -- veth5a36 any anywhere anywhere MARK set 0x1
Chain INPUT (policy ACCEPT 273 packets, 23305 bytes)
num pkts bytes target prot opt in out source destination
1 0 0 MARK tcp -- veth5a36 any anywhere anywhere MARK set 0x1
Chain FORWARD (policy ACCEPT 2750 packets, 7821109 bytes)
num pkts bytes target prot opt in out source destination
1 0 0 MARK tcp -- any veth5a36 anywhere anywhere MARK set 0x1
2 0 0 MARK tcp -- veth5a36 any anywhere anywhere MARK set 0x1
3 0 0 all -- veth5a36 eth0 anywhere anywhere mark match 0x1
Chain OUTPUT (policy ACCEPT 293 packets, 80020 bytes)
num pkts bytes target prot opt in out source destination
1 0 0 MARK tcp -- any veth5a36 anywhere anywhere MARK set 0x1
Chain POSTROUTING (policy ACCEPT 3043 packets, 7901129 bytes)
num pkts bytes target prot opt in out source destination
1 0 0 MARK tcp -- any veth5a36 anywhere anywhere MARK set 0x1
Can anybody tell me how to successfully mark packages from a docker container? Preferably using --uid-owner
but I will take anything at this point :)