Make container CLI auto-clean by default #24

Open
opened 2025-11-19 20:47:39 +00:00 by glenux · 0 comments
Owner

Summary

  • Switch container CLI behavior to clean up containers automatically unless the user requests otherwise.
  • Provide an explicit --keep-container (or similar) flag for debugging workflows.

Current behavior

docmachine container only removes containers when --auto-remove is set. Most commands run with the default (false), so even short-lived tasks leave behind stopped containers that accumulate across runs. The audit notes this surprises users who expect the CLI to clean up after itself.

Desired outcome

  • Enable auto-clean by default, offering an opt-out flag when users want to inspect containers.
  • Update CLI help and docs to explain the new default and the opt-out flag.
  • Cover success and failure pathways in specs to confirm cleanup happens consistently.

Technical notes

  • Add a new flag (e.g., --keep-container) in container/cli.cr and propagate it through Container::Config.
  • Update Container::Run#run_command to honour the flag when deciding whether to call cleanup_container.
  • Ensure interactions with existing --auto-remove remain clear and documented.

Local task: 11aa03

## Summary - Switch container CLI behavior to clean up containers automatically unless the user requests otherwise. - Provide an explicit `--keep-container` (or similar) flag for debugging workflows. ## Current behavior `docmachine container` only removes containers when `--auto-remove` is set. Most commands run with the default (`false`), so even short-lived tasks leave behind stopped containers that accumulate across runs. The audit notes this surprises users who expect the CLI to clean up after itself. ## Desired outcome - Enable auto-clean by default, offering an opt-out flag when users want to inspect containers. - Update CLI help and docs to explain the new default and the opt-out flag. - Cover success and failure pathways in specs to confirm cleanup happens consistently. ## Technical notes - Add a new flag (e.g., `--keep-container`) in `container/cli.cr` and propagate it through `Container::Config`. - Update `Container::Run#run_command` to honour the flag when deciding whether to call `cleanup_container`. - Ensure interactions with existing `--auto-remove` remain clear and documented. Local task: 11aa03
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: glenux/docmachine-cli#24
No description provided.