advancedScenario-Based & System Design Questions

A service works correctly when run with `docker run` directly but behaves differently (wrong config, missing env vars) when started via `docker compose up`.

Check whether the compose.yaml is missing `environment:`/`env_file:` entries that were being passed manually via `-e` flags in the direct `docker run` command, or whether a `.env` file in the Compose project directory is silently overriding expected values — `docker compose config` is useful here to print the fully resolved configuration and spot the discrepancy directly.

This is a Pro chapter

Sign in, then upgrade to Pro or Power to unlock this and the full DevOps Mastery library.

A service works correctly when run with `docker run` directly but behaves differently (wrong config, missing env vars) when started via `docker compose up`.

Next Step

Continue to A container running as a non-root user fails to write to a mounted volume with a permission denied error.← Back to all Docker questions