Docker Compose: tested guides
Docker Compose runs multi-container apps defined in a single compose.yaml file. Each guide below was checked against what docker compose config actually resolved, not just against the docs.
Our setup: Docker Compose v5.5.1 with Docker CLI 29.8.0 on macOS 15.3.1. docker compose config parses the compose file and .env without starting any container. Anything that only shows up in a running container is marked as unverified in the guide rather than guessed at. Windows and Linux hosts and older Compose versions (v1, early v2) were not tested.
The .env guide covers six reasons a variable does not end up where you expect. The first is the most basic: .env only feeds ${VAR} interpolation inside the compose file and is not passed into the container on its own. The others include where Compose looks for .env, why --env-file and env_file: resolve relative paths from different directories, and which source wins when the same variable is set twice.
-
Docker Compose Override File Not Working? Merge Rules Tested
Tested on Docker Compose v5.5.1: -f stops auto-loading compose.override.yaml, lists merge (don't replace), and !reset/!override actually work.
Fix -
Docker Compose .env Not Loading? 6 Real Causes, Tested
Tested on Docker Compose v5.5.1: .env only feeds interpolation, not the container. --env-file also resolves paths differently than env_file:.
Fix