Git Product home page Git Product logo

Comments (3)

fiunchinho avatar fiunchinho commented on June 14, 2024 3

Using the shell script to start your node application will do that your application doesn't receive signals. So for example, if you run your container and then try to docker stop it, it will take 10 seconds, since Docker sends a SIGTERM to stop your container, but your container doesn't handle signals (because shell is the main process), so after 10 seconds Docker gives up and sends a SIGKILL to kill the container. Receiving a SIGKILL could lead to unexpected behaviour if you are running for example an HTTP server. Normally we stop servers using graceful shutdown, instead of just killing them.

It'll also happen if you try to ctrl+c your container. It won't stop.

This won't happen with Tini.

from tini.

krallin avatar krallin commented on June 14, 2024

@zjleon the answer depends on what your shell script does; and whether it uses exec when starting your NodeJS server.

Can you post your shell script? I'd be able to provide a more accurate answer then :)

from tini.

zjleon avatar zjleon commented on June 14, 2024

@krallin thx for reply,
this is my shell script to start the node server

// container.dev.web_static.initial.sh
npm install --prefix ./src/web_static
npm run dev:web_static

in the dockerfile, I just copy it to the container, then execute it

ADD ./scripts/container.dev.web_static.initial.sh ./initial.sh
CMD ["bash", "./initial.sh"]

the shell script right now is real simple, I can't see too much benefit I can get from using tini(from what I learn from the README), Is that right?

from tini.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.