-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Add tini
as init system to improve signal handling in docker container
#6892
Conversation
Signed-off-by: Christian König <ckoenig@posteo.de>
Signed-off-by: Christian König <ckoenig@posteo.de>
Thanks for suggesting. So, as I read correctly, we would need to change all commands in our documentation to explicitly include |
No, the contributor has just followed the advice from the When starting a container it will run the entrypoint + cmd (default or user supplied), ENTRYPOINT ["/sbin/tini", "--", "mkdocs"]
CMD ["serve", "--dev-addr=0.0.0.0:8000"] This is only relevant to Docker Compose for the shutdown time concern being addressed however (doesn't apply to For reference here is a services:
docs:
#image: squidfunk/mkdocs-material
# Either of these would resolve the concern:
#init: true
#stop_grace_period: 0s
# Or extend the image (_bit pointless in this case_):
image: mkdocs-material-with-tini
build:
dockerfile_inline: |
FROM squidfunk/mkdocs-material
RUN apk add --no-cache tini
ENTRYPOINT ["/sbin/tini", "--", "mkdocs"]
CMD ["serve", "--dev-addr=0.0.0.0:8000"]
configs:
- source: mkdocs
target: /docs/mkdocs.yml
- source: hello
target: /docs/docs/index.md
ports:
- "8000:8000"
# Static inline config files for a quick example,
# normally these would be separate files mounted via `volumes` key.
configs:
# mkdocs.yml:
mkdocs:
content: |
site_name: Example
theme:
name: material
# index.md:
hello:
content: |
Hello **world**! |
Thanks for the clarification. I was interested whether we would need to change the API, as we would need to issue a new major release because all CI scripts using our Docker image would break – nothing were keen on doing for obvious reasons 😅 What's the upside of using |
Signed-off-by: Christian König <ckoenig@posteo.de>
This is what I intended to do. So it is independent of users who might not know I moved |
Prevents the creation of zombie processes, ensures default signal handlers work even if For a detailed explanation see krallin/tini#8 |
Thanks! |
Any chance this gets released soon? I run multiple Docker containers as development servers on my machine and they aren't responsive for a shutdown event (I can see |
@iBug you can just use any of the alternatives I suggested in the meantime: #6892 (comment) Just add |
Yes, it will be released soon. We do a release every 1-2 weeks, sometimes even more often. In the meantime, thanks to @polarathene for providing a workaround! |
I also feel I need to mention this again: |
So far, there was no init system on the docker container and any
SIGTERM
is lost somewhere between the host andmkdocs
. The consequence is that while stopping the container, nothing signaled docker that the process successful finished and docker waited the default 10 seconds before it killed the container.This PR adds
tini
as an init system which handles such signals and boost the shutdown