Repository navigation
Conversation
`devcontainer stop` stops the dev container and `devcontainer down` stops and removes it. The container is located via --container-id, --id-label, or --workspace-folder (defaulting to the current directory), and Docker Compose configurations are handled through the Compose project. `down --remove-volumes` also removes anonymous volumes (and named volumes declared in the Compose file for Compose configurations). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
|
@microsoft-github-policy-service agree |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add
devcontainer stopanddevcontainer downThe README listed
stopanddownas planned but unimplemented. This PR adds both commands.Usage
devcontainer stop [--workspace-folder | --container-id | --id-label <name=value>]
devcontainer down [--workspace-folder | --container-id | --id-label <name=value>] [--remove-volumes]
stopstops the dev container. Runningdevcontainer upagain restarts the same container.downstops the dev container and removes it.execfinds it: via--container-id,--id-label, or--workspace-folder(plus optional--config). If none of these is given,--workspace-folderdefaults to the current directory.--docker-path,--docker-compose-path,--log-leveland--log-format.Behavior
stoprunsdocker stop <id>.downrunsdocker rm -f <id>through the existingremoveContainerhelper, which now takes an optionalremoveVolumesflag that adds-v.com.docker.compose.projectlabel): the commands rundocker compose -p <project> stop|down, so every service in the project is handled.docker-compose), the Compose files are passed with-f, taken from the container'scom.docker.compose.project.config_fileslabel.--remove-volumes(downonly) removes anonymous volumes. For Compose configs it also removes named volumes declared in the Compose file (down -v).Dev container not found.and exits withsuccess. This makesdownsafe to run more than once.{"outcome":"success","containerId":"…","composeProjectName":"…"}
Changes
src/spec-node/devContainersSpecCLI.ts: adds thestopanddowncommands and their shared options.src/spec-shutdown/dockerUtils.ts:removeContainer()takes an optionalremoveVolumesparameter (defaultfalse), so existing callers behave the same.README.md: marksstopanddownas done and adds them to the command list.src/test/cli.stop-down.test.ts: new tests.Tests
src/test/cli.stop-down.test.tscovers:stopfollowed byupreuses the same containerdownby--workspace-folderand by--container-iddownwhen the container has already been removedstopanddownfor the whole project