Description
Given two services foo and bar where foo defines an env_file entry as a non-existent file. Running docker compose exec bar ... fails due to "env file not found".
This is inconsistent with e.g. docker compose up bar which runs successfully without attempting to validate the env_file of service foo
Steps To Reproduce
# compose.yaml
services:
foo:
image: hello-world
env_file:
- /does/not/exist/.env
bar:
image: hello-world
run:
docker compose exec bar bash
result:
env file /does/not/exist/.env not found: stat /does/not/exist/.env: no such file or directory
Compose Version
Docker Environment
Anything else?
No response