Skip to content

[BUG] COMPOSE_PROFILES not read from env file if --env-file flag is passed #11955

@mohan-13

Description

@mohan-13

Description

Current Behaviour:
When --env-file flag is passed from the command line and COMPOSE_PROFILES is specified in the env file, the value is not used for the profiles configuration.

Expected Behaviour:
The COMPOSE_PROFILES value specified in the env file should be set as the profile configuration and respective containers should be started.

Steps To Reproduce

Configuration Files:
docker-compose.yml

services:
  nginx1:
    image: nginx
    profiles:
      - nginx1
  nginx2:
    image: nginx
    profiles:
      - nginx2

.env.dev

COMPOSE_PROFILES=nginx1,nginx2

When we run
docker compose --env-file .env.dev up -d
a message
no service selected is thrown.

But both the services nginx1,nginx2 should be started.

Compose Version

docker compose version:
Docker Compose version v2.27.1-desktop.1

docker-compose version:
Docker Compose version v2.27.1-desktop.1

Docker Environment

Server:
 Server Version: 26.1.4
 Storage Driver: overlay2 
 Kernel Version: 6.6.31-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 Name: docker-desktop

Client:
 Version:    26.1.4
 Context:    desktop-linux
 Debug Mode: false

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions