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

[Swarm mode] Define signals used to stop containers for updates #25696

Closed
mvdstam opened this issue Aug 14, 2016 · 11 comments · Fixed by #30754
Closed

[Swarm mode] Define signals used to stop containers for updates #25696

mvdstam opened this issue Aug 14, 2016 · 11 comments · Fixed by #30754
Labels
area/swarm kind/enhancement Enhancements are not bugs or new features but can improve usability or performance.
Milestone

Comments

@mvdstam
Copy link

mvdstam commented Aug 14, 2016

I'm not sure, but I suspect docker does a docker stop (ie. sending a SIGTERM to a container, and then a SIGKILL after waiting 10 seconds) when performing "rolling updates" on a service. With some images, like [https://hub.docker.com/_/httpd/](those powered by apache2), this is actually a destructive (non-graceful) way to stop containers, since apache needs a SIGWINCH to actually shutdown in a graceful way.

It would be awesome if we could define a signal used to stop services when creating them, for example:

docker service create --stop-signal SIGWINCH --name my-apache-container httpd:latest

@thaJeztah thaJeztah added kind/enhancement Enhancements are not bugs or new features but can improve usability or performance. area/swarm labels Aug 14, 2016
@thaJeztah
Copy link
Member

Thanks for suggesting; docker service does not have all options that are present on docker run, but we're planning to add more options in future releases (although not all options will find their way). I added this issue to #25303, which is used to keep track on progress; you can subscribe to that issue to stay op to date.

@mvdstam
Copy link
Author

mvdstam commented Aug 14, 2016

Cheers @thaJeztah!

@pnickolov
Copy link

pnickolov commented Aug 24, 2016

My $.02 - consider making the signal # to use for stopping a container/service part of the Dockerfile rather than being part of the command to create the container/service.

The Dockerfile sets the boundary and the termination signal expected of the installed software is part of the boundary, not of any particular instance. This way, the knowledge belongs where it is defined (i.e., with the software being encapsulated); it will travel together with the image, just like the exposed ports and command.

@vingrad
Copy link

vingrad commented Jan 3, 2017

+1

@thaJeztah
Copy link
Member

I realised I didn't mention that here, but although you cannot override the stop-signal when creating a service, if an image should always be stopped with a specific stop-signal; you can define the stop-signal in the Dockerfile (using the STOPSIGNAL command), e.g.;

FROM httpd:2.2
STOPSIGNAL WINCH

Docker services will take that into account when stopping the container;

INFO[0120] Container 52aca76dd0c25e733f43121b4097103aae5f2dd125a36c083407d5b61eb8ae50
failed to exit within 10 seconds of signal 28 - using the force

@aluzzardi
Copy link
Member

I think --stop-signal should make it into the ServiceSpec (/cc @ehazlett)

@aluzzardi aluzzardi added this to the 1.14.0 milestone Jan 31, 2017
@ehazlett
Copy link
Contributor

ehazlett commented Feb 1, 2017

@aluzzardi Yes I agree. Here is a tracking issue to get feedback: #30634

@thaJeztah
Copy link
Member

@ehazlett were already tracking missing options through #25303 😇

@ehazlett
Copy link
Contributor

ehazlett commented Feb 2, 2017

Oh well in that case... :)

@ehazlett
Copy link
Contributor

ehazlett commented Feb 2, 2017

Oops didn't mean to close :)

@yongtang
Copy link
Member

yongtang commented Feb 6, 2017

Added a PR #30754 and a SwarmKit PR moby/swarmkit#1924 for --stop-signal.

yongtang added a commit to yongtang/docker that referenced this issue Feb 16, 2017
This fix tries to update the SwarmKit from
ed384f3
to
6bc357e

The following is the list of docker related changes:
1. Took long time for Docker Swarm service turn desired state from Ready to Running (Issue moby#28291)
2. Native Swarm in 1.12 - panic: runtime error: index out of range (Issue moby#25608)
3. Global mode target replicas keep increasing (Issue moby#30854)
4. Creating service with publish mode=host and without published port crashes swarm manager (Issue moby#30938)
5. Define signals used to stop containers for updates (Issue moby#25696) (PR moby#30754)

This fix fixes moby#28291, moby#25608, moby#30854, moby#30938.
This fix is required by PR moby#30754.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/swarm kind/enhancement Enhancements are not bugs or new features but can improve usability or performance.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants