Skip to content

[BUG] docker compose start/stop/restart does not automatically enable profiles with explicitly targeted service  #9986

Closed
@Valgard

Description

Description

I have a docker compose file like this:

services:

  app1:
    [...]

  app2:
    [...]
    profiles:
    - app2

I can bring up app2 with docker compose up app2.

But the commands

  • docker compose start app2
  • docker compose stop app2
  • docker compose restart app2

do not automatically enable profile app2 and fail silently or with message no such service: app2.

Regading Using service profiles and Compose Specification i expected that the commands automatically enable the profile.

Steps To Reproduce

  1. With this config
services:
  app1:
    image: hello-world
  
  app2:
    image: hello-world
    profiles:
      - app2
  1. Run docker compose up -d app2
  2. docker compose start app2 fails with message no such service: app2
  3. docker compose stop app2 fails silently
  4. docker compose start app2 fails silently

Compose Version

$ docker compose version                                                                                                                                                      
Docker Compose version v2.12.1

$ docker-compose version                                                                                                                                                      
Docker Compose version v2.12.1

Docker Environment

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc., v0.9.1)
  compose: Docker Compose (Docker Inc., v2.12.1)
  dev: Docker Dev Environments (Docker Inc., v0.0.3)
  extension: Manages Docker extensions (Docker Inc., v0.2.13)
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc., 0.6.0)
  scan: Docker Scan (Docker Inc., v0.21.0)

Server:
 Containers: 18
  Running: 12
  Paused: 0
  Stopped: 6
 Images: 13
 Server Version: 20.10.20
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runtime.v1.linux runc io.containerd.runc.v2
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6
 runc version: v1.1.4-0-g5fd4c4d
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
  cgroupns
 Kernel Version: 5.15.49-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 6
 Total Memory: 19.55GiB
 Name: docker-desktop
 ID: WQ3P:EAX7:2L4Y:A4R3:YW4L:IHXR:BI2V:S723:CUXF:HMFL:WKIN:BUHB
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 No Proxy: hubproxy.docker.internal
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5000
  127.0.0.0/8
 Live Restore Enabled: false

Anything else?

No response

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