Skip to content

Services with profile in yml, always enable when execute command start, stop, restart, up #9286

Closed
@ani3llyon

Description

@ani3llyon

Since docker compose v 2.3.0 when ever I run docker compose with command start, stop, restart, and up all container for service with profile in docker-compose.yml will be always included even the profile is not enabled.

example command

# will create container for service without profile but will start all container
# even the container is for service with profile
docker compose up -d

# will start/stop/restart all container even the container is for service with profile
docker compose start
docker compose stop
docker compose restart

example docker-compose.yml

version: "3.9"
services:
  serviceA:
    ...
  serviceB:
    ...
    profiles: ["debug"]

step by step

# will create and start container for service A
docker compose up -d

# will start/stop/restart container for service A
docker compose start
docker compose stop
docker compose restart

# will stop and remove container for service A
docker compose down

# will create and start container for service B
docker compose up -d serviceB

# will stop container for service B
docker compose stop serviceB

# will create and start container for service A
# also start serviceB <-- why? profile 'debug' is not enabled
docker compose up -d

# will start/stop/restart container for service A
# also start/stop/restart serviceB <-- why? profile 'debug' is not enabled
docker compose start
docker compose stop
docker compose restart

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions