How to stop running node in docker

后端 未结 8 1972
广开言路
广开言路 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:49

    I don't know if this is too late. But the correct way to do this is to catch the SIGINT (interrupt signal in your javascript).

    var process = require('process')
    process.on('SIGINT', () => {
      console.info("Interrupted")
      process.exit(0)
    })
    
    

    This should do the trick when you press Ctrl+C

    0 讨论(0)
  • 2021-02-13 18:50
    1. docker stop <containerName/containerId>
    2. docker kill --signal=SIGINT <containerName/containerId>
    3. docker rm -f <containerName/containerId>
    0 讨论(0)
提交回复
热议问题