How to kill process inside container? Docker top command

后端 未结 4 1565
天涯浪人
天涯浪人 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:36

    Took me a while to find the right answer, but you will have to manage this process from within the container. When you run docker top a66 from the host, the PIDs are from your host, although that's not quite the case if using Cygwin. Regardless, you will need to bash or what-have-you back into your container and use commands like ps aux and kill while in the container to find and manage the different PIDs for the same processes there.

提交回复
热议问题