compose icon indicating copy to clipboard operation
compose copied to clipboard

`--no-deps` flag causes `no such service: <dependency>` error after upgrade to compose v2.3

Open jasonccox opened this issue 4 years ago • 4 comments

Description

docker compose up --no-deps <service> fails with no such service: <dependency>

Steps to reproduce the issue:

  1. Create a compose file with the following contents:
version: '2.1'

services:
    dep:
      image: alpine:3
      command: sleep 60

    main:
      image: alpine:3
      depends_on:
        - dep
      command: echo DONE
  1. Run docker compose down && docker compose up --no-deps main

Describe the results you received:

Command fails with no such service: dep.

Describe the results you expected:

Command succeeds, running only the main service.

Additional information you deem important (e.g. issue happens only occasionally):

N/A

Output of docker compose version:

Docker Compose version v2.3.3

Output of docker info:

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc., v0.8.0)
  compose: Docker Compose (Docker Inc., v2.3.3)
  scan: Docker Scan (Docker Inc., v0.17.0)

Server:
 Containers: 65
  Running: 0
  Paused: 0
  Stopped: 65
 Images: 62
 Server Version: 20.10.13
 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: runc io.containerd.runc.v2 io.containerd.runtime.v1.linux
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 2a1d4dbdb2a1030dc5b01e96fb110a9d9f150ecc
 runc version: v1.0.3-0-gf46b6ba
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
  cgroupns
 Kernel Version: 5.10.104-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 15.64GiB
 Name: docker-desktop
 ID: UMR2:LKQL:2ISH:EQBH:Q2WI:7NKQ:QQQZ:W6RT:PE6B:IUAG:SC2N:PTCC
 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

Additional environment details:

N/A

jasonccox avatar Mar 21 '22 20:03 jasonccox

https://github.com/docker/compose/pull/9365 should fix the issue.

maxcleme avatar Apr 07 '22 11:04 maxcleme

Closed by https://github.com/docker/compose/pull/9365

ndeloof avatar Apr 08 '22 08:04 ndeloof

This is still an issue on Mac docker 4.9.1. Very annoying having to bring down the whole docker-compose stack instead of restarting a single container.

maximbashevoy avatar Jun 24 '22 09:06 maximbashevoy

Still seeing this on Mac. Tested on Rocky Linux and not seeing this.

  • docker 4.21.1
  • engine 24.0.2
  • compose 2.19.1

docker compose file

services:
    app:
        depends_on:
            db:

error

$ docker compose  run --no-deps --remove-orphans  -- app ./run_linters.sh backend
service db is required by app but is disabled. Can be enabled by profiles []

jvang-vtas avatar Jul 10 '23 23:07 jvang-vtas