balena-io-library / resin-rpi-raspbian

Apache License 2.0
74 stars 27 forks source link

SIGTERM is not being propagated to node process #44

Closed zikolach closed 7 years ago

zikolach commented 7 years ago

Using FROM hypriot/rpi-node. After executing docker stop on running container SIGTERM handler are not called.

process.on('SIGTERM', function () {
  console.log('Exiting');
});

Dockerfile looks like:

FROM hypriot/rpi-node
ADD package.json /src/
WORKDIR /src
RUN npm i
ADD main.js /src/
CMD node main.js

After changing CMD to ENTRYPOINT it works for docker stop, but not for Ctrl+C when running container with -it flags.