Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

How to limit a container's network usage or bandwidth?

I searched the Internet but it seems no existing mature solutions.

I can modify the host, but cannot modify the program running in docker or docker itself. It means I can change the configurations, but not the code of docker that I need to re-build/re-compile.

like image 232
I Wonder Avatar asked Apr 25 '18 21:04

I Wonder


2 Answers

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
like image 120
Haoyuan Ge Avatar answered Sep 28 '22 06:09

Haoyuan Ge


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.

like image 40
VonC Avatar answered Sep 28 '22 07:09

VonC