Skip to content

[BUG] config --images should not fail on missing env_file #10995

@homersimpsons

Description

@homersimpsons

Description

I'm extracting informations about docker-compose.yml files using docker compose config.

I would expect this command to be rather dumb, but it looks like it tries to fully load the config.

Using the --images argument should not require an env_file, in fact the env_file is only required to populate service's environment and this is not required to display the list of images.

Not that none of --no-consistency, --no-interpolate, --no-normalize and --no-path-resolution bypass this issue.

Steps To Reproduce

  1. Given the following docker-compose.yml file:
version: "3"

services:
  test:
    image: hello-world:latest
    env_file:
      - .env
  1. Running docker compose config --images
  2. Outputs: Failed to load /tmp/a/.env: open /tmp/a/.env: no such file or directory with return code 14

Compose Version

❯ docker compose version
Docker Compose version v2.21.0


### Docker Environment

```Text
I doubt this is relevant.

Anything else?

I could not find documentation about return codes for the docker compose config command.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions