Skip to content

[BUG] exec attempts to validate env_file for a different non-dependent service #13601

Closed

Description

@ollie-bell

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

v5.0.2

Docker Environment


Anything else?

No response

Activity

  1. changed the title [-][BUG] docker compose exec <service> <command> attempts to validate env_file for a different non-dependent service[/-] [+][BUG] docker compose exec attempts to validate env_file for a different non-dependent service[/+] on Feb 20, 2026
  2. changed the title [-][BUG] docker compose exec attempts to validate env_file for a different non-dependent service[/-] [+][BUG] exec attempts to validate env_file for a different non-dependent service[/+] on Feb 20, 2026
  3. maxproske commented on Feb 21, 2026

    @maxproske
    Contributor

    This is a gap from #13156 where I fixed ps/logs/down but missed exec and some other commands. PR incoming.

  4. github-actions commented on Jul 26, 2026

    @github-actions

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions