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

查看:127
本文介绍了如何限制 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-shaping

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天全站免登陆