Docker Hub Images with graceful shutdown
A prism docker image does not correctly handle SIGTERM and SIGKILL signals.
Current Behavior
Following your documentation I start a container with prism
version: '3'
services:
prism_1:
image: stoplight/prism
command: >
mock -p 4010 --host 0.0.0.0
https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v2.0/yaml/petstore.yaml
When I press CTRL+C it sends SIGTERM signal (which is ignored) and after default 10s timeout container is stopped.
Expected Behavior
When I press CTRL+C it sends SIGTERM signal container should stop immediately.
Possible Solution(s)
Use dumb-init or alternatives to gracefully shut down prism as recommended in 10 best practices to containerize Node.js web applications with Docker
FROM node:16.17.0-bullseye-slim as build
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates wget
RUN wget -O /usr/local/bin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.5/dumb-init_1.2.5_x86_64
FROM stoplight/prism
COPY --from=build /usr/local/bin/dumb-init /usr/local/bin/dumb-init
RUN chmod +x /usr/local/bin/dumb-init
RUN chmod +x /usr/local/bin/prism
ENTRYPOINT ["/usr/local/bin/dumb-init", "--", "/usr/local/bin/prism"]
PS: On your Docker Hub and here in this repo I was unable to find Dockerfiles which were used to generate Docker Hub's images. I would love to see "Supported tags and respective Dockerfile links" like eg. MySQL has. That would make debugging and possibly fixing this issue much easier.