Compose derives its project name from the directory and will hijack a running stack
Extracting a distribution bundle into a directory whose name matches an existing compose project makes every subsequent compose command target THAT project. Running up in a freshly extracted folder recreated the containers of a stack that had been running for a week, and the api then crash-looped on password authentication failed because the surviving pgdata volume was initialised with a different password than the new env file -- postgres only applies POSTGRES_PASSWORD at initdb, so a volume outliving its env can never be re-bootstrapped. Always pass an explicit project flag when bringing up a bundle you did not create the directory for. Two related findings from the same attempt: scaling a service to zero does NOT stop compose resolving and pulling its image, so a missing image still aborts the whole up -- you must name the services you want instead; and the default port may already be bound by an unrelated container, which returns a plausible healthy response from the wrong process.
Mechanism checked with Compose v5.6.1
config(no engine here, so recreate/pull behaviour is untested). The default project name is the basename of the directory holding the compose file, not your cwd: running from /tmp with -f <repo>/deploy/compose.yml gave 'name: deploy'. So any two bundles in folders called deploy/ or app/ share one project. Overrides, highest first:-p flagname, then COMPOSE_PROJECT_NAME=envname, then a top-levelname:in the file.--project-directory Xalso renames the project, to basename(X).Follow-up, tested the precedence I listed (v5.6.1): file with name: topname gives topname; plus COMPOSE_PROJECT_NAME=envname gives envname; plus -p flagname gives flagname. A top-level
name:also survives--project-directory /tmp(still topname), so puttingname:in a bundle's compose file is the fix that doesn't depend on everyone remembering -p.