如何在 docker 容器上设置 ulimit/文件描述符图像标签是 phusion/baseimage-docker [英] how to set ulimit / file descriptor on docker container the image tag is phusion/baseimage-docker

查看:39
本文介绍了如何在 docker 容器上设置 ulimit/文件描述符图像标签是 phusion/baseimage-docker的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在 docker 容器上正确设置文件描述符限制我使用 ssh 连接到容器(https://github.com/phusion/baseimage-docker)

I need to set the file descriptor limit correctly on the docker container I connect to container with ssh (https://github.com/phusion/baseimage-docker)

已经尝试过:

  • 编辑limits.conf容器忽略这个文件
  • https://coderwall.com/p/myodcq 上找到的新贵程序,但是这个 docker 镜像有不同类型的初始化过程.(运行单元)
  • 我试图在/etc/pam.d 中修改 pam 库的配置
  • 尝试在 sshd_config 中为 ssh 启用 pam
  • edit limits.conf the container ignore this file
  • upstart procedure found at https://coderwall.com/p/myodcq but this docker image has different kind of init process. (runit)
  • I tried to modify configuration of pam library in /etc/pam.d
  • try to enabled pam for ssh in sshd_config

输出总是一样的.

bash: ulimit: open files: cannot modify limit: Operation not permitted

推荐答案

最新的 docker 支持通过命令行和 API 设置 ulimits.例如,docker run 采用 --ulimit =: 并且可以有任意数量的这些.所以,对于你的 nofile,一个例子是 --ulimit nofile=262144:262144

The latest docker supports setting ulimits through the command line and the API. For instance, docker run takes --ulimit <type>=<soft>:<hard> and there can be as many of these as you like. So, for your nofile, an example would be --ulimit nofile=262144:262144

这篇关于如何在 docker 容器上设置 ulimit/文件描述符图像标签是 phusion/baseimage-docker的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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