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

support forwarding signals #127

Merged
merged 1 commit into from
Mar 15, 2020
Merged

Conversation

AkihiroSuda
Copy link
Member

Before:

$ dockerd-rootless.sh --experimental
...
INFO[2020-03-15T11:02:16.526051714+09:00] API listen on /run/user/1001/docker.sock     
^C
$ echo $?
130

After:

$ dockerd-rootless.sh --experimental
...
INFO[2020-03-15T11:02:42.263959577+09:00] API listen on /run/user/1001/docker.sock     
^CINFO[2020-03-15T11:02:43.493624366+09:00] Processing signal 'interrupt'                
INFO[2020-03-15T11:02:43.494655209+09:00] Processing signal 'interrupt'                
INFO[2020-03-15T11:02:43.495386457+09:00] stopping event stream following graceful shutdown  error="<nil>" module=libcontainerd namespace=moby
INFO[2020-03-15T11:02:43.495546067+09:00] Daemon shutdown complete                     
INFO[2020-03-15T11:02:43.495566660+09:00] stopping event stream following graceful shutdown  error="context canceled" module=libcontainerd namespace=plugins.moby
INFO[2020-03-15T11:02:43.495587614+09:00] stopping healthcheck following graceful shutdown  module=libcontainerd
INFO[2020-03-15T11:02:43.495986508+09:00] Processing signal 'interrupt'
$ echo $?
0

The implementation is based on /~https://github.com/docker/cli/blob/ef2f64abbd37edfa148f745fa0013731b5074d1b/cli/command/container/tty.go#L99-L12

@AkihiroSuda
Copy link
Member Author

cc @ibuildthecloud

for _, s := range SignalMap {
handledSigs = append(handledSigs, s)
}
signal.Notify(sigc, handledSigs...)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason this isn't just doing signal.Notify(sigc)? (which should catch all signals without an explicit list)

(Also opencontainers/runc#2257, which I'm guessing you've probably already seen 😄)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copypasta from moby 😓

docker-jenkins pushed a commit to docker-archive/docker-ce that referenced this pull request Mar 30, 2020
See rootless-containers/rootlesskit#127

RootlessKit changes: rootless-containers/rootlesskit@v0.9.1...v0.9.2

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
Upstream-commit: f310bd29bd5ab52caa0536c85d564461a70abf16
Component: engine
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

Successfully merging this pull request may close these issues.

2 participants