-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Feature Summary
Add a delete command that removes a container's filesystem and manifest entry — the inverse of create. Supports a --force flag to kill running containers before deletion.
cargo run -- delete busybox-container
cargo run -- delete busybox-container --force
Problem/Use Case
There's no way to clean up containers after they're created and stopped. Users have to manually delete directories and edit container_manifest.json. Every container runtime needs a way to remove containers.
Proposed Solution
delete removes the container directory under {BENTO_CONTAINERS_PATH}/{name}/ and its entry in container_manifest.json.
Default behavior:
- Deletes containers in
CreatedorStoppedstate - Refuses to delete
Runningcontainers
With --force:
- Kills running containers first (SIGKILL), then deletes
Container not found → bail, same as other commands.
Does NOT touch the image directory — images are shared across containers.
Acceptance Criteria
- Feature is implemented and working
- Tests are written and passing
- Documentation is updated
- Performance impact is acceptable
Priority
Medium
Implementation Details
Files to touch: bento_cli.rs, main.rs, runtime.rs
Things to be aware of:
rollback_container_manifest()androllback_dirs()already exist and do most of the heavy lifting- After
--forcekilling a running container, there's a race with the parent process infork_into_namespacesdoing itswaitpid→ status update →unmount_and_clean_up. Look at howstophandles this timing (the sleep + poll pattern around line 527-549 ofruntime.rs) - Handle the case where the container directory is already gone (someone manually deleted it) — still clean the manifest
- Handle the case where manifest says
RunningbutpidisNone—--forceshould still clean up even ifkill_container()fails
UX messages:
🍱 Container {name} deleted🍱 Container {name} killed and deletedContainer '{name}' is currently running. Use --force to kill and delete it.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request