1. 在go项目中接受系统信号:
quit := make(chan os.Signal, 1) signal.Notify(quit, os.Interrupt, os.Kill) <-quit
2. 在docker-compose中构建添加配置 stop_signal: SIGINT,如下:
blockchain-api: restart: always stop_signal: SIGINT build: context: ./../blockchain-api-dev
1. 在go项目中接受系统信号:
quit := make(chan os.Signal, 1) signal.Notify(quit, os.Interrupt, os.Kill) <-quit
2. 在docker-compose中构建添加配置 stop_signal: SIGINT,如下:
blockchain-api: restart: always stop_signal: SIGINT build: context: ./../blockchain-api-dev