如何限制docker镜像的网络使用或带宽? [英] How to limit docker image's network usage or bandwidth?

查看:321
本文介绍了如何限制docker镜像的网络使用或带宽?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何限制容器的网络使用或带宽?

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

我在互联网上进行搜索,但似乎没有现有的成熟解决方案。

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

我可以修改主机,但是不能修改在docker或docker本身中运行的程序。这意味着我可以更改配置,但不能更改需要重新构建/重新编译的docker的 code

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.

推荐答案

Kubernetes现在具有实验性功能,可以限制网络带宽:
https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/network-plugins/#support-traffic-成形

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

这篇关于如何限制docker镜像的网络使用或带宽?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆