Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should run with tini as pid 1 to avoid zombie npmlazy #26

Closed
jamshid opened this issue Feb 25, 2018 · 1 comment
Closed

Should run with tini as pid 1 to avoid zombie npmlazy #26

jamshid opened this issue Feb 25, 2018 · 1 comment

Comments

@jamshid
Copy link

jamshid commented Feb 25, 2018

Sorry I don't have a repro but I think my npmlazy container locks up in some scenarios like when the docker server runs out of memory and it tries to kill the container.

I think the problem is that npmlazy is running as pid 1 -- you should always use a init system or tini instead. E.g. see:

https://blog.ghaiklor.com/avoid-running-nodejs-as-pid-1-under-docker-images-when-running-them-on-mesosphere-kubernetes-or-b7bd505657f9

I'm working around this by using this Dockerfile:

mynpmlazy/Dockerfile

ARG NPMLAZY_VERSION
FROM langrisha/npm-lazy:${NPMLAZY_VERSION}
ENV TINI_VERSION v0.17.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini
ENTRYPOINT ["/tini", "-v", "-e", "143", "--", "node", "index.js"]

And start my npmlazy container using something like this in my docker-compose.yml:

  # https://registry.hub.docker.com/u/langrisha/npm-lazy/
  # To use add: ENV npm_config_registry http://${DOCKER_BUILD_CACHE_HOST}:8181
  npmlazy:
    restart: always
    image: mynpmlazy
    build:
      context: mynpmlazy/.
      args:
        - NPMLAZY_VERSION=1.11.0
    mem_limit: 500m
    memswap_limit: 500m
    volumes:
      - /root/.npm_lazy
    command: --show-config --port=80 --external-url=http://${DOCKER_BUILD_CACHE_HOST}:8181
@jamshid
Copy link
Author

jamshid commented Feb 3, 2020

Closing this since adding init: true to the docker-compose.yml service accomplishes the same thing.

@jamshid jamshid closed this as completed Feb 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant