Skip to content

Clean up Docker build intermediates - #60

Open
X1pheR wants to merge 1 commit into
ckreiling:mainfrom
X1pheR:fix/build-intermediate-cleanup
Open

Clean up Docker build intermediates#60
X1pheR wants to merge 1 commit into
ckreiling:mainfrom
X1pheR:fix/build-intermediate-cleanup

Conversation

@X1pheR

@X1pheR X1pheR commented Aug 8, 2026

Copy link
Copy Markdown

Summary

Pass Docker SDK rm=True and forcerm=True from the build_image tool so intermediate containers are removed on both successful and failed image builds.

Problem

docker.images.build() defaults do not force intermediate-container cleanup. Repeated MCP builds can therefore leave non-Compose intermediate containers behind, especially after failures.

Change

Add the two Docker SDK cleanup flags to the existing build call and extend the hermetic call-contract assertion.

Validation

  • ruff check src tests
  • pytest -q: 6 passed
  • Live validation against the same Docker daemon covered both a successful build and an intentionally failing Dockerfile; both paths left zero new containers after the invocation.

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