mirror of
https://github.com/docker/compose.git
synced 2026-09-23 14:04:35 +00:00
A failing pre_start hook container is now retained (AutoRemove: false) so operators can run 'docker logs <id>' and 'docker ps -a' to diagnose the failure. On success the container is removed explicitly, mirroring the old AutoRemove behaviour including anonymous volumes. Before each pre_start run, stale hook containers from a previous failed run are detected via project+service+HookLabel filters and force-removed so they do not accumulate. Changes: - pkg/api/labels.go: add HookLabel (com.docker.compose.hook) - pkg/compose/filters.go: add hookFilter helper - pkg/compose/pre_start.go: - AutoRemove: false in createPreStartContainer - HookLabel added to container labels - runPreStartHook: explicit ContainerRemove on success; retain on failure - removeOrphanPreStartContainers: new helper called in runPreStart - Tests: update all existing pre_start tests for the new flow; add feature tests (success removes, failure retains, orphan cleanup) and coverage-gap tests (lowestNumberedContainer, waitPreStart cancel, preStartResultErr, streamPreStartLogs error paths, old-API network paths, ExecCreate/Attach/Inspect errors, hookExitError branches) Coverage after: hook.go 100%, pre_start.go most functions 100% (was 89% and 64% respectively per Codecov delta). Signed-off-by: Guillaume Lours <glours@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| api.go | ||
| api_test.go | ||
| context.go | ||
| env.go | ||
| errors.go | ||
| errors_test.go | ||
| event.go | ||
| labels.go | ||
| labels_test.go | ||