Skip to content

Stop leaving the volume-init container behind - #121

Merged
Ilyes512 merged 1 commit into
mainfrom
build/cleanup-volume-init-containers
Sep 19, 2026
Merged

Ilyes512 merged 1 commit into
mainfrom
build/cleanup-volume-init-containers

Conversation

@Ilyes512

Copy link
Copy Markdown
Member

Summary

  • One defer: docker compose rm --stop --force volume-init on the internal dc task, which every compose invocation passes through — so it covers dc:run:*, dc:build, dc:shell and the lint, docs, markdown and demo taskfiles that call into it.
  • Task runs deferred commands when the task ends regardless of its result, so a failing test tears the container down too.

Why

docker compose run --rm removes the container it was asked to run and nothing else. Every service that writes to the cache volume pulls in volume-init through depends_on, so each task left a completed labelsync-volume-init-1 behind — harmless, but one stale container per project accumulating where only docker ps -a shows it.

Ported from specsnl/specs-cli#147.

Verified locally

task checkall green, and docker ps -a --filter name=volume-init is clean afterwards for this checkout's compose project — where an unpatched checkout of the same repository still leaves its container behind.

… run

`docker compose run --rm` removes the container it was asked to run and nothing
else. Every service that writes to the cache volume pulls in volume-init through
depends_on to get the directories created and chowned, so each task left a
completed labelsync-volume-init-1 behind — harmless, but it accumulates one
stale container per project that only ever surfaces in `docker ps -a`.

The internal dc task is the single point every compose invocation passes
through, so one defer there covers dc:run:*, dc:build, dc:shell and the lint,
docs, markdown and demo taskfiles that call into it. Task runs deferred commands
when the task ends regardless of its result, so a failing test tears the
container down too. The teardown is the same defer the demo:record task already
uses for the socket proxy.
@Ilyes512
Ilyes512 merged commit a2d4972 into main Sep 19, 2026
5 checks passed
@Ilyes512
Ilyes512 deleted the build/cleanup-volume-init-containers branch September 19, 2026 13:54
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.

1 participant