gpt4 book ai didi

node.js - 使用docker时无法从 Node 应用退出

转载 作者:行者123 更新时间:2023-12-02 21:25:48 25 4
gpt4 key购买 nike

当我使用docker运行应用程序时,CRT + C没有停止该节点应用程序。以下是我已完成的步骤。非常感谢您的帮助。

我的节点应用程序。

var config  = require('./config.json');
var mongodb = require('mongodb');
var request = require('request');
var http = require('http');

// Debug log entry when starting the daemon.
console.log("REST daemon started successfully.\n");
console.log("The daemon interval is : "+ config.queue_interval +".\n");


// Resetting failed REST calls if there are any.
if (config.reset_when_start) resetCallbacks();

// Calling processQueue with the given interval.
setInterval(setSubDaemon, config.queue_interval);
setSubDaemon();

function setSubDaemon() {
// my code is here.
}

然后是我用于运行nodeapp的docker命令。
docker run --link mongo:mongo -v /home/eranga/workspace/clms/daemon:/opt -p 127.0.0.1:8087:8080 custom-node-image

最佳答案

如果您想退出docker node app,请使用以下命令
CTRL + P + Q

关于node.js - 使用docker时无法从 Node 应用退出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38758544/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com