mirror of
https://github.com/docker/compose.git
synced 2026-10-12 02:13:08 +00:00
A pre_start hook container retained after failure (introduced in the previous commit) is created without ConfigHashLabel so getContainers() and every downstream compose operation (down, ps, stop, rm) is blind to it. Without explicit cleanup it would survive compose down. This commit adds removePreStartHookContainers(), called from down() after regular container teardown and before network removal (so hook containers are gone before their networks are removed). The cleanup is project-wide on a full compose down; scoped to the requested services when compose down <svc...> is used. Individual ContainerRemove errors are logged at warn level and do not abort the teardown. Changes: - pkg/compose/down.go: removePreStartHookContainers helper + call in down() - pkg/compose/filters.go: add //nolint:unparam to hookFilter (param is architecturally correct; today only preStartHookType is in use) - pkg/compose/down_test.go: update all existing down tests to expect the new ContainerList call; add TestDownRemovesRetainedPreStartHookContainers and TestDownHookContainerRemovalFailureIsNonFatal Signed-off-by: Guillaume Lours <[email protected]>