【发布时间】:2019-07-13 20:25:12
【问题描述】:
当我从 hub.docker.com 拉出 debian:stretch-slim,然后运行容器(root)时,我发现 bash: sysctl: command not found。
如何在 debian:stretch-slim 中使用 sysctl?
许多图像是从 debian:stretch-slim 构建的,所以当我想在其他一些容器中使用 sysctl 时:
docker run --rm -it redis:latest --sysctl net.core.somaxconn=2048 redis-server
它会抛出错误消息。
可以这样测试:
docker pull debian:stretch-slim
docker run --rm -it debian:stretch-slim bash
root@7b923f27f7ee:/# sysctl
bash: sysctl: command not found
【问题讨论】:
-
apt-cache search sysctl也许? -
/sbin/sysctl -a也许? -
如果您真的需要容器中的
sysctl实用程序 -apt-get update && apt-get install procps。 -
很好,
apt-get install procps可以工作 -
其他人通过 google,别忘了它需要以 root 身份运行,所以
sudo sysctl net.core.somaxconn=2048在裸机上。
标签: linux bash docker debian debian-stretch