Skip to content

Profiles how-to has possible typo or is unclear #21258

@zwimer

Description

@zwimer

Is this a docs issue?

  • My issue is about the documentation content or website

Type of issue

Information is incorrect

Description

When a service with assigned profiles is explicitly targeted on the command line its profiles are started automatically so you don't need to start them manually. This can be used for one-off services and debugging tools. As an example consider the following configuration:

I believe this is either incorrect, or unclear enough that I am misunderstanding it. Specifically, the way I read this it says, for example, given:

services:

  foo:
    container_name: foo_c
    profiles: [ test ]
    image: alpine
    command: [ "sleep", "10000" ]

  bar:
    container_name: bar_c
    profiles: [ test ]
    image: alpine
    command: [ "sleep", "10000" ]

Running docker compose up -d foo (a service with assigned profiles explicitly targeted on the command line) should parse profiles: [ test ] (its profiles) and start them automatically (so you don't need to start them manually). I.e. this command should start the profile test and thus the services within test, which includes bar. However, when I do this:

$ docker --version
Docker version 27.3.1, build ce12230
$ docker compose up -d foo
[+] Running 2/2
 ✔ Network foo_default  Created                                                                                      0.3s
 ✔ Container foo_c      Started

Where as if I explicitly start start the profile: docker compose --profile test up -d I get:

$ docker compose --profile test up -d
[+] Running 3/3
 ✔ Network foo_default  Created                                                                                      0.3s
 ✔ Container bar_c      Started                                                                                      0.6s
 ✔ Container foo_c      Started

If my interpretation is not a documentation error and is indeed intended, I can move this bug report over to a different repo, i.e. docker or compose, whichever is preferred.

Location

https://docs.docker.com/compose/how-tos/profiles/

Suggestion

If the documentation is correct and the behavior demonstrated is correct, then either I'm missing something obvious or the clarity of the documentation needs to be improved.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/composeRelates to docker-compose.yml spec or docker-compose binarylifecycle/locked

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions