Enable PAM configuration (limits.conf) for a running daemon

后端 未结 1 930
春和景丽
春和景丽 2021-01-21 11:18

I\'m currently attempting to develop a sandbox using Docker. Docker spawns process through a running daemon, and I am having a great deal of trouble enabling the limits set fort

1条回答
  •  孤城傲影
    2021-01-21 11:56

    The PAM limits only apply to processes playing nice with PAM. By default, when you start a shell in a container, it won't have anything to do with PAM, and setting limits through PAM just won't work.

    Here are some other ways to make it happen!

    1. Instead of starting your process immediately, you can start a tiny wrapper script, which will do the appropriate ulimit calls before executing your process.

    2. If you want an interactive shell, you can run login -f (e.g. login -f root); that will use the normal login process to auto-log you on the machine (and that should go through the normal PAM mechanisms).

    3. If you want all containers to be subject to those limits, you can set the limits on your system, then restart Docker with those lower limits; containers are created by Docker, and by default, they will inherit those limits as well.

    0 讨论(0)
提交回复
热议问题