[英]‘Nice-ness’ of a process inside a container
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.
我需要将新进程的 nice 值设置得更高。
When ran on the OS I could just do nice -n19 second_task
.在操作系统上运行时,我可以做
nice -n19 second_task
。 How does this work in the context of the docker container?这在 docker 容器的上下文中如何工作?
First of all one container should run only one process that is its single responsibility, containers should not be treated 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 could do nice
in your Dockerfile CMD parameter. nice
应该像在主机上一样工作,因为容器进程最终是主机上的进程,所以你可以在你的 Dockerfile CMD 参数中做得nice
。 But this is something that you should control with a container orchestrator that is kube.netes for today de facto (there are other ones like docker swarm and nomad)但这是你应该使用容器编排器控制的东西,它实际上是今天的 kube.netes(还有其他的,比如 docker swarm 和 nomad)
When ran on the OS I could just do nice -n19 second_task.
在操作系统上运行时,我可以很好地执行 -n19 second_task。 How does this work in the context of the docker container?
这在 docker 容器的上下文中如何工作?
It works exactly the same way.它的工作方式完全相同。 When you're inside docker OS, you can just
nice -n19 second_task
.当您在 docker 操作系统中时,您可以
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.与外部 docker 操作系统完全相同的限制适用,因此
nice
可执行文件必须存在于 docker 操作系统内部才能运行,同样nice
可执行文件必须存在才能在主机操作系统上运行nice
。 And user has to have appropriate limits (see man limits.conf
) or be root.并且用户必须有适当的限制(参见
man limits.conf
)或者是 root。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.