Skip to content

docker stop (SIGTERM) not sent to NodeJS process (v0.7.0) #2878

Closed

Description

@codeaholics

Build the following image:

FROM ubuntu:12.04

RUN apt-get update
RUN apt-get install -y curl git
RUN ln -sf /bin/bash /bin/sh

# Install NodeJS
RUN curl https://raw.github.com/creationix/nvm/master/install.sh | HOME=/root sh
RUN source /root/.nvm/nvm.sh && nvm install 0.10.20
RUN source /root/.nvm/nvm.sh && nvm alias default 0.10.20

# Configure the service
CMD source /root/.nvm/nvm.sh && node -e 'process.on("SIGTERM", function(){console.log("SIGTERM");process.exit(0);}); setInterval(function(){},1000);'

Run with docker run -d <image>.

Attach with docker attach <container>.

Attempt to stop with docker stop <container>.

Note that 'SIGTERM' is never logged, and the stop times out and reverts to a kill.

However, if I run this outside a container and kill the Node process with kill <pid> it successfully receives the SIGTERM, logs and exits.

It appears that, for some reason, the Node process isn't getting the SIGTERM.

I've tested with the bash script in #2436 and everything works fine, so this isn't just outright 'docker stop is broken', but instead some kind of strange interaction between Docker and NodeJS.

Activity

  1. crosbymichael commented on Nov 26, 2013

    @crosbymichael
    Contributor

    ping @creack

  2. codeaholics commented on Nov 28, 2013

    @codeaholics
    ContributorAuthor

    @creack Do you have any update on this? You said on IRC you suspected it was something to do with init. We have Node processes which like to talk to Redis/Hipache, etc. as they're shutting down and they don't get the chance. :-(

  3. codeaholics commented on Dec 2, 2013

    @codeaholics
    ContributorAuthor

    ping @creack

  4. crosbymichael commented on Mar 6, 2014

    @crosbymichael
    Contributor

    dup of #2436

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions