How to kill process inside container? Docker top command

后端 未结 4 1514
天涯浪人
天涯浪人 2021-02-02 09:36

I have simple example from official guide at docker website.

I run the following:

sudo docker run -d ubuntu:latest /bin/sh -c \"while true; do echo hello         


        
4条回答
  •  遇见更好的自我
    2021-02-02 10:28

    When I reproduce your situation I see different PIDs between docker top and docker exec -it ps -aux. When you do docker exec the command is executed inside the container => should use container's pid. Otherwise you could do the kill without docker straight from the host, in your case: sudo kill -9 25055.

提交回复
热议问题