feat: implement devcontainer stop and down commands#1041
feat: implement devcontainer stop and down commands#1041monotykamary wants to merge 6 commits intodevcontainers:mainfrom
Conversation
- Add 'devcontainer stop' command to stop running containers - Add 'devcontainer down' command to stop and remove containers - Support --all flag to target all devcontainers - Support --workspace-folder to target specific workspace - Support --id-label for custom label filtering - Support --remove-volumes for down command - Update README.md to mark both commands as completed - Handle both single container and Docker Compose configurations
|
@microsoft-github-policy-service agree |
|
poke @bamurtaugh :-) |
…ands - List containers before stopping/removing in docker-compose projects - Return actual container IDs in removedContainers/stoppedContainers arrays - Report correct containersFound count for docker-compose configurations - Ensures proper visibility of which containers are affected by operations
Fixed observability for docker-compose projectsThe issue where Changes:
Example output after fix:The |
chrmarti
left a comment
There was a problem hiding this comment.
Thanks for the PR! Left a few comments.
- Use proper logging output instead of dropping log messages - Add dockerPath parameter support for Docker/Podman compatibility - Change --all flag to use devcontainer.metadata label for safer filtering - Add error logging for container inspection and volume removal failures - Follow existing codebase patterns for dockerComposeCLI configuration
|
Sincerest thanks for the thorough review! I've made all the requested changes: ✅ Fixed issues:
|
|
This looks great! Thanks for the fix! @chrmarti / @monotykamary Is there anything left in this MR that I can help with? |
|
@ MS: Please merge! This PR is over six months old now and sorely needed. |
you'd figure a 2-3 year issue that motivated the creation of a new OSS project (devpod) would have been solved by someone else at some point 🎅 |
Description
This PR implements the
devcontainer stopanddevcontainer downcommands as requested in #386.Changes
devcontainer stopcommand to stop running dev containers without removing themdevcontainer downcommand to stop and remove dev containers--workspace-folderto target containers in a specific workspace--allflag to target all dev containers--id-labelfor filtering by custom labels--remove-volumesflag (down command only) to also remove associated volumesTesting
Tested locally with the devcontainer-cli project itself:
Starting a dev container:
Stopping the container:
Verifying container is stopped but not removed:
Removing the container:
Verifying container is completely removed:
Fixes
Fixes #386