Skip to content

CICD-130 · Run a one-shot Compose task ​

Encyclopedia · Docker runtime and Compose · All snippets

Previous · CICD-129 · Next · CICD-131

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.

2. Copy the snippet ​

bash
docker compose run --rm -T web python -m pytest -q

3. How it works ​

Compose launches a one-off container with the service configuration. Its exit status gives the task result. Pytest discovers the selected test files or markers and returns a process exit status reflecting the test outcome.

4. Verify the result ​

Test image must include pytest and repository fixture files.

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