Skip to content

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

Closed

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

Activity

  1. ShadowLNC commented on Jul 5, 2024

    @ShadowLNC

    Duplicate #11856

  2. eliphazbouye commented on Jul 12, 2024

    @eliphazbouye

    A pull request about has been merged about that, I think it fixes your issue @mohan-13 because it same with #11856 closed now

  3. jhrotko commented on Jul 18, 2024

    @jhrotko
    Contributor

    Hello, @mohan-13

    I checked for version v2.28.1 and it's working as expected.

    Screenshot 2024-07-18 at 10 29 55

    Thank you for your contribution!

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