Skip to content

CICD-131 · Tear down only the test project ​

Encyclopedia · Docker runtime and Compose · All snippets

Previous · CICD-130 · Next · CICD-132

1. Where it fits ​

  • Placement Bash run step following checkout, or equivalent lab terminal.
  • Prerequisites disposable Docker or Compose project with example web service.
  • Platforms local-linux, github-actions, gitea-actions.
  • Parameters COMPOSE_PROJECT_NAME.

2. Copy the snippet ​

bash
docker compose --project-name "${COMPOSE_PROJECT_NAME:?}" down --remove-orphans

3. How it works ​

The required project name limits operations to one disposable stack. The command removes its network and orphaned containers without opting into volume deletion.

4. Verify the result ​

Use a per-run name. Preserve volumes unless you explicitly intend to discard test data.

Validation syntax-validated (Bash parse). Status definitions.