这是参考https://docs.docker.com/config/containers/resource_constraints/#limit-a-containers-access-to-memory。我已经创建了工作容器,使用 Raspbian Jessie Lite(本质上是无 GUI 的 Debian Jessie)在 Raspberry Pi(64 位)上运行 Docker 版本 18.05.0-ce。
该文档声称您可以在docker run命令上传递内存/cpu 标志。但是当我尝试类似的东西时docker run -it --name test --memory=512m container_os,它会说:
WARNING: Your kernel does not support swap limit capabilities or the cgroup is not mounted. Memory limited without swap
如果我传递基于 cpu 的标志,例如--cpuset-cpus. 这显然意味着我没有为 Docker 安装这些不同的 cgroup 来正确管理资源,对吧?
现在参考https://docs.docker.com/config/containers/runmetrics/#control-groups,我阅读了关于 cgroups 的部分,但这对我理解情况并没有太大帮助。因此,与其只是尝试随机的内核命令,有经验的人有没有一步一步地解释如何以正确的方式做到这一点?