Docker Compose API verification demo

Verified: 2026-10-24, macOS arm64 client / local Docker Desktop Linux engine
Docker Desktop: 4.55.0
Docker Engine: 29.1.3
Compose: v2.40.3-desktop.1
Container Python: 3.13.17
Image: python:3.13-alpine@sha256:bf12ecc0bea3f171d55145dd02c78b5eeb09f30ee2ac9cc2b4c9e4e8f5e30741

Educational API only: in-memory data, no published ports, disposable generated token.
HTTP is used only for this isolated local demo. Do not use a real credential.
The readiness file is a deterministic teaching fixture, not a real dependency check.

Run from the extracted compose-api-demo directory in a POSIX shell:

python3 init_token.py
demo_project="compose-api-demo-$(date +%Y%m%d%H%M%S)-$$"
docker compose -p "$demo_project" config --quiet
docker compose -p "$demo_project" up -d api
docker compose -p "$demo_project" run --rm --no-deps worker not-ready
docker compose -p "$demo_project" exec -T api python -c "from pathlib import Path; Path('/tmp/demo-ready').touch()"
docker compose -p "$demo_project" run --rm worker
docker compose -p "$demo_project" down

Check each exit code before proceeding. If a command fails, inspect its output.
Use the same demo_project value and this directory for cleanup, even on failure.
The worker tries to delete its generated resource in a finally block; forced
termination or network failure can still prevent that cleanup. In this example
all API records disappear when its container is removed (in-memory store).
No volumes or production services are used. Do not replace cleanup with prune.

After removing the demo stack, delete only the generated local token:
python3 -c "from pathlib import Path; Path('.secrets/demo_token.txt').unlink()"

init_token.py refuses to overwrite an existing token. For reruns, remove the
old stack before generating a replacement token. The base image remains cached.
execution-log.txt contains the observed run, with no token value.
