Separate development projects with explicit names
A Compose project groups resources for an application instance. Running the same model with two different project names lets you keep independent containers and project-managed networks. In this exercise -p selects bm-v14-alpha or bm-v14-beta. Each runs the same image with a different synthetic runtime label. Query each project separately, then remove alpha and confirm beta is still running. Project names do not isolate globally named images, external resources, host paths or host ports. They are organizational scope, not an access-control boundary.
Read the development model
services: worker: image: busybox:1.37 pull_policy: never user: 10001:10001 command: - sleep - '300' environment: BM14_LABEL: ${BM14_LABEL:?choose lab label} networks: - appnetworks: app: internal: trueManual lab
Manual lab only, not browser execution. Use a fresh approved disposable Linux VM with external egress blocked and a local Docker context. Check docker context show, docker version and docker compose version; verify the exact options and fields. Preload and verify a native-platform BusyBox 1.37 image digest, entrypoint and required applets; the tag is mutable. For builds verify a local Buildx docker driver using the reviewed base, with network blocked. Check all bm-v14 project and image names are unused and inherited Compose settings do not interfere. Use only a disposable copy of the supplied synthetic files; confirm UID 10001 can read source files. No public ports, external pulls/pushes, real secrets, broad host mounts or privileged containers. Run each line separately, stop on unexpected failures, clean only the lab and dispose of the VM. All results are predictions. Before Engine requests, verify the effective endpoint including DOCKER_HOST and DOCKER_CONTEXT; a project name does not select the daemon. Review inherited COMPOSE_ENV_FILES, COMPOSE_DISABLE_ENV_FILE, profile and project settings. Use a clean shell and the exact fixture directory. Inspect only synthetic config, logs and files. If a build is required, verify the effective builder can resolve the approved local base without egress; stop if build fails, never reuse a stale tag.
Open lab-fixtures/docker-compose-development/07-isolated-projects/ in the extracted archive and run from a disposable copy of that folder.
BM14_LABEL=alpha docker compose -f compose.yaml -p bm-v14-alpha config --quietBM14_LABEL=beta docker compose -f compose.yaml -p bm-v14-beta config --quietBM14_LABEL=alpha docker compose -f compose.yaml -p bm-v14-alpha up -d --no-build --pull neverBM14_LABEL=beta docker compose -f compose.yaml -p bm-v14-beta up -d --no-build --pull neverBM14_LABEL=alpha docker compose -f compose.yaml -p bm-v14-alpha exec -T worker printenv BM14_LABELBM14_LABEL=beta docker compose -f compose.yaml -p bm-v14-beta exec -T worker printenv BM14_LABELBM14_LABEL=alpha docker compose -f compose.yaml -p bm-v14-alpha downBM14_LABEL=alpha docker compose -f compose.yaml -p bm-v14-alpha ps -aBM14_LABEL=beta docker compose -f compose.yaml -p bm-v14-beta exec -T worker printenv BM14_LABELAlpha should report alpha and beta should report beta. After down on alpha, beta should still report beta. Both projects must be cleaned separately. Compare both project worker IDs before removing alpha. Verify alpha is absent immediately afterward and beta retains its original running ID; matching text alone does not establish identity.
Clean only the named lab projects; no global prune or force removal. Retain the reviewed base image. A failed cleanup requires VM disposal and review.
BM14_LABEL=alpha docker compose -f compose.yaml -p bm-v14-alpha ps -aBM14_LABEL=beta docker compose -f compose.yaml -p bm-v14-beta downBM14_LABEL=beta docker compose -f compose.yaml -p bm-v14-beta ps -aCommon mistake
Never use a production project name for a lab. Shared resources with explicit global names can defeat the independence you expected.
Manual practice
Explain how two team members could use different project names yet still collide on a published host port.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Separate development projects with explicit names — Knowledge check
Reason about development workflows and their effects.
What does -p select?
Does down alpha normally remove beta containers?
What is not isolated by a project name?