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

19,175

Start your container with this command:

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

Share:
19,175
Wei
Author by

Wei

Updated on June 17, 2022

Comments

  • Wei
    Wei almost 2 years

    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.

    How can I use sysctl in debian:stretch-slim?

    and many images are builded from debian:stretch-slim, so when I want to use sysctl in some other containers like that:

    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
    
  • Dimitri Kopriwa
    Dimitri Kopriwa over 4 years
    I am having this error in gitlab-ci runner when trying to use expo cli. Where should I add this command? at the docker gitlab ci runner level ?
  • Thilak
    Thilak over 4 years
    @DimitriKopriwa Can you create a new thread with some detailed information (command used, error details, etc..)? So that it will help us analyze the issue.
  • Nadir Latif
    Nadir Latif over 3 years
    Docker does not support setting all sysctl values. See this link: docs.docker.com/engine/reference/commandline/run/…. Certain kernel parameters cannot be set within Docker containers. They need to be set on the host computer