How to kill process inside container? Docker top command

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

    check this:

    ps | grep -i a66 | tr -s ' '|cut -f2 -d' '|
    {
        while read line;
        do kill -9 $line;
        done
    }
    

    to understand this start from executing commands from left till end of each pipe (|)

    Simpler option:

    kill $(pidof a66) 
    

提交回复
热议问题