"bash: sysctl: command not found" 在 debian:stretch-苗条

"bash: sysctl: command not found" in debian:stretch-slim

当我从 hub.docker.com 中拉出 debian:stretch-slim,然后 运行 一个容器(root)时,我发现 bash: sysctl:找不到命令

如何在 debian:stretch-slim 中使用 sysctl?

很多图像都是从 debian:stretch-slim 构建的,所以当我想在其他一些容器中使用 sysctl 时:

docker run --rm -it redis:latest --sysctl net.core.somaxconn=2048 redis-server

它会抛出 ERROR 信息。

可以这样测试:

docker pull debian:stretch-slim
docker run --rm -it debian:stretch-slim bash
root@7b923f27f7ee:/# sysctl
bash: sysctl: command not found

使用此命令启动您的容器:

docker run --rm -it --sysctl net.core.somaxconn=2048 redis:latest redis-server

--sysctl 应该是 docker 运行 的参数,它不应该是对你的 redis 图片

的命令