How to limit docker image's network usage or bandwidth?

Docker issue 9607 refers to bridge network, and issue 4763 is still opened.

So this is not yet natively supported by docker.

Kubernetes issue 2856 references a sidecar option: istio, so that would be your best approach, if you can add an orchestrator to your current docker setup.


Kubernetes now has an experimental feature that enables limiting network bandwidth: https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/network-plugins/#support-traffic-shaping

apiVersion: v1
kind: Pod
metadata:
  annotations:
    kubernetes.io/ingress-bandwidth: 1M
    kubernetes.io/egress-bandwidth: 1M