name: local-docker-k3d-alignment description: When adding or changing preconditions, cleanup steps, or env usage for local Docker Compose or local k3d, keep both in sync where they share resources (e.g. infra/config/local/*.env).
Local Docker vs k3d alignment
When to use
When modifying Makefile targets or scripts that:
- Start or stop local Docker Compose services or the local k3d cluster
- Read or write
infra/config/local/*.env(generated frominfra/env/classification/viascripts/local-env/setup.sh, not from.env.examplestubs) - Check for “running” state before running env clean, setup, or reset
Rule
Keep Docker and k3d local behavior aligned where they share resources (e.g. env files). If a target aborts when Docker containers are running, consider aborting when the k3d cluster is running when the same env files are in use. Full teardown / clean targets should also tear down the k3d cluster, not only Docker.
Commands that should consider k3d: (1) Guards: any target that refuses to run while Docker is up and touches shared env (e.g. local_env_clean) should also refuse while k3d is up. (2) Teardown: any "clean" or "full teardown" target (e.g. local_clean) should run local_k3d_down so both Docker and k3d are stopped. (3) Docs: where local env or k3d is described, note shared env and that local_clean tears down both.
Do
infra/config/local/*-sidecar.envvsapps/*/sidecar/.env:local_env_setupgenerates both withmerge-env: infra files use--profile local_docker(Composeenv_file); appsidecar/.envfiles use--profile dev(host npm). They are independent outputs, not copies; do not assume byte parity.- Guard
local_env_cleanon both Docker Compose containers and the k3d cluster; document that both useinfra/config/local/*.env(Postgres: singledb.env; Valkey:valkey-source-only.env,valkey.env). - Include k3d in "full teardown" targets:
local_cleanshould runlocal_k3d_downso Docker, k3d, and test/E2E are all torn down. - When adding a precondition or cleanup step that touches
infra/config/local/*.envor “running” state, apply the same logic to both Docker and k3d (or document why they differ).
Don't
- Don’t add Docker-only or k3d-only guards for shared env without considering the other (e.g. cleaning env while k3d is up leaves the cluster with stale secrets).
Examples
- local_env_clean: Aborts if Boilerplate local containers are running (
make local_down) and also if the k3d cluster is running (make local_k3d_down). - local_clean: Full teardown runs
local_down,local_down_volumes,local_k3d_down(idempotent if cluster is gone), andtest_cleanso both Docker and k3d are stopped. - Docs:
local_env_setupandlocal_k3d_upboth consumeinfra/config/local/*.env; mention this where describing local env or k3d setup. Document thatmake local_cleantears down k3d as well as Docker.