In a CI deploy step, docker exec $(docker compose -f docker-compose.yml ps -q <service>) <command> ran <command> as if it were a container name instead of a command — the substitution resolved to nothing.
Fix: docker compose ps re-parses and interpolates the whole compose file just like up/pull do. When the env file isn't at the default ./.env location next to the compose file, every subcommand needs its own --env-file flag, not just the steps that already had it. Without it, ${VAR}-style interpolation fails silently, ps -q returns no output, and docker exec $(...) collapses to docker exec <command>, misinterpreting the intended command as the container name.
docker-composeci-cdenv-fileinterpolation
References
- https://docs.docker.com/compose/how-tos/environment-variables/variable-interpolation/ — Compose reads a .env file next to the compose file by default; --env-file is required to point at a non-default location, and this applies per invocation/subcommand, not just up.