Home > Net >  ‘Nice-ness’ of a process inside a container
‘Nice-ness’ of a process inside a container

Time:11-19

So in my current app setting a certain process running inside a container runs another process. I need to set the nice value of the new process to be higher.

When ran on the OS I could just do nice -n19 second_task. How does this work in the context of the docker container?

CodePudding user response:

When ran on the OS I could just do nice -n19 second_task. How does this work in the context of the docker container?

It works exactly the same way. When you're inside docker OS, you can just nice -n19 second_task.

Exactly the same restrictions apply as outside docker OS, so nice executable has to exists inside docker OS to be run, the same way the nice executable has to exist for you to run nice on your host OS. And user has to have appropriate limits (see man limits.conf) or be root.

CodePudding user response:

First of all one container should run only one process that is its single responsibility, containers sgould not be threated like vms but like boundaries (container:)) for your services.

Nice should work the same as it is working on the host because container processes are eventually processes on the host, so you cold do nice in your Dockerfile CMD parameter. But this is sonething that you should controll with a container orchestrator that is kubernetes for today de facto (there are other ones like docker swarm and nomad)

  • Related