Skip to content

docker compose start/stop/restart fails with depending container disabled via profiles #9575

@leo-schick

Description

@leo-schick

Description

I have a docker-compose.yml like this:

version: '3.1'

services:

  mara-app:
    [...]
    depends_on:
      - mssql

  mara-mssql:
    [...]
    profiles: ["dev"]

I can bring the docker compose up and down with docker compose up -d or docker compose down. But the commands

  • docker compose start mara-app
  • docker compose stop mara-app
  • docker compose restart mara-app

Describe the results you received:

all fail with a missing dependency message:

image

Describe the results you expected:

Docker compose should ignore the dependecy to service mara-mssql because it is disabled by the profiles: ["dev"] parameter. It should only check for the dependent service when I use docker compose --profile dev ...

In case I am wrong here and start/stop/restart should not work, I would suggest to add a validation error/warning when calling e.g. docker-compose up/down.

Output of docker compose version:

Docker Compose version v2.6.0

Output of docker info:

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Docker Buildx (Docker Inc., v0.8.2-docker)
  compose: Docker Compose (Docker Inc., v2.6.0)
  scan: Docker Scan (Docker Inc., v0.17.0)

Server:
 Containers: 3
  Running: 3
  Paused: 0
  Stopped: 0
 Images: 10
 Server Version: 20.10.17
 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: 1
 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.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 10c12954828e7c7c9b6e0ea9b0c02b01407d3ae1
 runc version: v1.1.2-0-ga916309
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: default
 Kernel Version: 4.19.0-20-amd64
 Operating System: Debian GNU/Linux 10 (buster)
 OSType: linux
 Architecture: x86_64
 CPUs: 2
 Total Memory: 3.854GiB
 Name: srv-mara-1
 ID: 4BMZ:MAGW:V47G:YNSA:EQED:7GD2:KVXH:D2BV:JMA6:KCCB:VSK3:52YE
 Docker Root Dir: /data/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: No swap limit support

Additional environment details:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 10 (buster)
Release:        10
Codename:       buster
$

Metadata

Metadata

Assignees

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