# Get the container's PID
PID=$(docker inspect --format '{{.State.Pid}}' throttled-app)
# Find the interface index inside the container's network namespace
IFINDEX=$(nsenter -t $PID -n ip link show eth0 | head -1 | awk -F: '{print $1}')
# Find the matching veth interface on the host
VETH=$(ip link | grep "if${IFINDEX}:" | awk -F: '{print $2}' | tr -d ' '|cut -d'@' -f1)
echo "Host veth interface: $VETH"
sudo tc qdisc add dev $VETH root tbf \
rate 50mbit burst 100mbit latency 100ms
Remove limit
this is required to update the limit
sudo tc qdisc del dev $VETH root tbf \
rate 50mbit burst 100mbit latency 100ms