docker / docker/cli

A way to kill the container by signaling `docker run`

Open
#5,489 3 comments 0 reactions 1 assignee View on GitHub

@laurazard is already working on this.

Since Oct 4, 2024.

kind/feature status/0-triage
Dominant language
Go
Stars
6.1k
Forks
2.2k
Avg merge
1d 15h
Merged PRs (30d)
43

Description

Description

The docker run --sig-proxy can't forward SIGKILL because it can't actually receive it without dying itself. But this means there's no way to send SIGKILL to the contained process by signaling docker run, and thus, as far as I can tell, no way to achieve the effect of docker kill and reliably destroy the attached container by signaling docker run.

I would like to be able to configure docker run to tear down the attached container upon receiving some signal (maybe SIGTERM or SIGHUP), regardless of whether it was started with --init or what the PID 1 process inside chooses to do in response to signals.

Workarounds for not having this feature:

  • Use --init (and hope you didn't need your container's own init process or handling of any signals that Docker's init uses, and that Docker's init doesn't hang or get a gdb attached to it or otherwise malfunction).
  • Use a shell script that wraps docker run, traps a signal, and issues a docker kill.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.