moby/builder
Sebastiaan van Stijn 1f9098e7d0
builder: remove redundant ExecBackend.ContainerKill()
The `ExecBackend.ContainerKill()` function was called before removing a build-
container.

This function is backed by `daemon.ContainerKill()` which, if no signal is passed,
performed a `daemon.Kill()`, using `SIGKILL` as signal. However, the
`ExecBackend.ContainerRm()` (backed by `daemonContainerRm()`), which is called
after this, is executed with the `ForceRemove` option set, which calls
`daemon.cleanupContainer()` with `ForceRemove` set, which also results in
`daemon.Kill()` being called:
1a0c15abbb/daemon/delete.go (L84-L95)

This makes the `ExecBackend.ContainerKill()` redundant, so removing this from
the interface.

While looking at this code, one (possible) race-condition was found in
`daemon.cleanupContainer()`, where `daemon.Kill()` could return a `errdefs.Conflict`
if the container was already stopped. An extra check was added for this case to
prevent `daemon.cleanupContainer()` from terminating early.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-01-05 17:36:41 +01:00
..
builder-next add //go:build directives to prevent downgrading to go1.16 language 2023-12-15 15:24:15 +01:00
dockerfile builder: remove redundant ExecBackend.ContainerKill() 2024-01-05 17:36:41 +01:00
remotecontext pkg/containerfs: deprecate ResolveScopedPath 2024-01-02 15:32:31 +01:00
builder.go builder: remove redundant ExecBackend.ContainerKill() 2024-01-05 17:36:41 +01:00