简体   繁体   English

如何限制docker镜像的网络使用或带宽?

[英]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.我可以修改主机,但不能修改在 docker 中运行的程序或 docker 本身。 It means I can change the configurations, but not the code of docker that I need to re-build/re-compile.这意味着我可以更改配置,但不能更改我需要重新构建/重新编译的 docker代码

Docker issue 9607 refers to bridge network , and issue 4763 is still opened. Docker issue 9607指的是bridge networkissue 4763还是open。

So this is not yet natively supported by docker.所以这还没有被 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 问题 2856引用了一个sidecar 选项: istio ,因此如果您可以将协调器添加到当前的docker 设置中,这将是您的最佳方法。

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 Kubernetes 现在有一个可以限制网络带宽的实验性功能: 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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM