How to stop running node in docker

后端 未结 8 2009
广开言路
广开言路 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条回答
  •  猫巷女王i
    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

提交回复
热议问题