You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For node:18.16.1-alpine3.18 and below the SIGTERM is received. But all above versions [I tried node:20.11.0-alpine3.18] its not received. Used command with init.
Steps to Reproduce
For both the version follow below steps
Nodejs
var http = require("http");
http.createServer(function (request, response) {
// Send the HTTP header
// HTTP Status: 200 : OK
// Content Type: text/plain
response.writeHead(200, { 'Content-Type': 'text/plain' });
// Send the response body as "Hello World"
response.end('Hello World\n');
}).listen(8081);
// Console will print the message
console.log('Server running at http://127.0.0.1:8081/');
process.on('SIGTERM', () => {
console.log('Received SIGTERM signal. Shutting down gracefully...');
console.log('Server closed. Exiting...');
process.exit(0);
});
Dockerfile
FROM node:20.11.0-alpine3.18
# FROM node:18.16.1-alpine3.18
# Copy the application's code to the container
COPY . /app
# Set the working directory
WORKDIR /app
# Install the application's dependencies
RUN npm install
# Expose port 8181
EXPOSE 8101
# Start the application
CMD ["npm", "start"]
Please see points 3 and 4 for both the outputs above.
For v20 it does not log the signal and gets forcefully shutdown with exit code 137
For v18 it logs the signal and the application closes with the expected exit code.
The text was updated successfully, but these errors were encountered:
That looks like npm/cli#6684 (comment); so, the fix is to update npm to at least 10.3.0. I verified that npm start failed to forward the signals (and node server.js worked), but if I upgraded npm, then npm start worked again.
Environment
Expected Behavior
docker stop command should trigger SIGTERM signal
Current Behavior
For node:18.16.1-alpine3.18 and below the SIGTERM is received. But all above versions [I tried node:20.11.0-alpine3.18] its not received. Used command with init.
Steps to Reproduce
For both the version follow below steps
Additional Information
Steps and commands followed along with its output
NODE VERSION 18.16.1
NODE VERSION 20
Please see points 3 and 4 for both the outputs above.
For v20 it does not log the signal and gets forcefully shutdown with exit code 137
For v18 it logs the signal and the application closes with the expected exit code.
The text was updated successfully, but these errors were encountered: