docker 设置 ulimit
一、 通过docker run –ulimit 参数设置这个容器的 ulimit 值
docker run --ulimit nofile=1024:1024 --rm debian sh -c "ulimit -n"
二、通过配置 daemon.json 配置默认值
配置nofile
{
"default-ulimits": {
"nofile": {
"Name": "nofile",
"Hard": 64000,
"Soft": 64000
}
}
}
配置core
{
"default-ulimits": {
"core": {
"Name": "core",
"Hard": 0,
"Soft": 0
}
}
}
systemctl daemon-reload
systemctl restart docker
文档: https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-configuration-file
本文来自博客园,作者:EJW,转载请注明原文链接:https://www.cnblogs.com/ejjw/p/17967404