debian:stretch-slim 中的“bash: sysctl: command not found”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/54781393/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
"bash: sysctl: command not found" in debian:stretch-slim
提问by Wei
when I pull the debian:stretch-slim from hub.docker.com, and then run a container(root), I find that bash: sysctl: command not found.
当我从 hub.docker.com 拉出 debian:stretch-slim,然后运行容器(root)时,我发现bash: sysctl: command not found。
How can I use sysctl in debian:stretch-slim?
如何在 debian:stretch-slim 中使用 sysctl?
and many images are builded from debian:stretch-slim, so when I want to use sysctlin some other containers like that:
并且许多图像是从 debian:stretch-slim 构建的,所以当我想在其他一些容器中使用sysctl时:
docker run --rm -it redis:latest --sysctl net.core.somaxconn=2048 redis-server
docker run --rm -it redis:latest --sysctl net.core.somaxconn=2048 redis-server
It will throw ERROR message.
它会抛出错误消息。
It can be tested like:
可以这样测试:
docker pull debian:stretch-slim
docker run --rm -it debian:stretch-slim bash
root@7b923f27f7ee:/# sysctl
bash: sysctl: command not found
采纳答案by Thilak
Start your container with this command:
使用以下命令启动您的容器:
docker run --rm -it --sysctl net.core.somaxconn=2048 redis:latest redis-server
docker run --rm -it --sysctl net.core.somaxconn=2048 redis:latest redis-server
--sysctl
should be docker run's argument and it should not be a command to your redis
image
--sysctl
应该是 docker run 的参数,它不应该是对您的redis
图像的命令