How to stop running node in docker

后端 未结 8 1984
广开言路
广开言路 2021-02-13 18:02

I have just installed dockers and installed node. I am able to run a basic express site. My issue now is I can\'t stop it. Control-C is not doing anything.

Temporarily w

8条回答
  •  一生所求
    2021-02-13 18:33

    From what I can gather you need both -t and -i for Ctrl-C to work as expected. Command like this would be helpful i believe.

    Simple example which i can think of this below Case 1 to retain container:

    $ ID=$(sudo docker run -t -d ubuntu /usr/bin/top -b)
    $ sudo docker attach $ID
    Control-C
    $ sudo docker ps
    

    Case 2 to terminate the container:

    $ ID=$(sudo docker run -t -i -d ubuntu /usr/bin/top -b)
    $ sudo docker attach $ID
    Control-C
    $ sudo docker ps
    

提交回复
热议问题