Docker Ignores limits.conf (trying to solve “too many open files” error)

前端 未结 3 1887
梦毁少年i
梦毁少年i 2021-02-01 06:11

I\'m running a web server that is handling many thousands of concurrent web socket connections. For this to be possible, on Debian linux (my base image is google/debian:wheezy,

3条回答
  •  青春惊慌失措
    2021-02-01 07:02

    With docker-compose you could configure ulimits.

    https://docs.docker.com/compose/compose-file/#ulimits

    You can add soft/hard limits as a mapping.

    ulimits:
      nproc: 65535
      nofile:
        soft: 20000
        hard: 40000
    

    Although not ideal you could run container with privileged option (Mostly for a quick non-optimal solution for a Dev environment, not recommended if security is a concern).

    docker run --privileged
    

    Please see:

    https://docs.docker.com/engine/reference/run/#runtime-privilege-and-linux-capabilities

提交回复
热议问题