Skip to content

up with --no-deps flag leads to no such service errors for dependent services when using condition: service_healthy #9591

Closed
@nocive

Description

@nocive

Description

Steps to reproduce the issue:

  1. Use the following docker-compose.yml file:
version: '3.8'
services:
  my-service:
    image: alpine
    command: tail -f /dev/null
    depends_on:
      nginx: {condition: service_healthy}

  nginx:
    image: nginx:alpine
    healthcheck:
      test:     "echo | nc -w 5 localhost:80"
      interval: 30s
      timeout:  5s
      retries:  5
  1. docker compose up -d
  2. docker compose up -d --force-recreate --no-deps my-service

Describe the results you received:
An error regarding a dependent service which is started, running and healthy.

 ⠿ Container dcompose-repro-my-service-1  Recreated                                                                                                                            10.6s
no such service: nginx

$ docker compose ps
NAME                          COMMAND                  SERVICE             STATUS              PORTS
dcompose-repro-my-service-1   "tail -f /dev/null"      my-service          created             
dcompose-repro-nginx-1        "/docker-entrypoint.…"   nginx               running (healthy)   80/tcp

Describe the results you expected:
No errors and the container to be recreated successfully.

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

Output of docker compose version:

Docker Compose version v2.6.1

Output of docker info:

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc., v0.8.2-docker)
  compose: Docker Compose (Docker Inc., v2.6.1)

Server:
 Containers: 256
  Running: 50
  Paused: 0
  Stopped: 206
 Images: 170
 Server Version: 20.10.16
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: false
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 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.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 96df0994faabc1944fc614e52b0b3c6feb609a57.m
 runc version: 
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
  cgroupns
 Kernel Version: 5.18.1-arch1-1
 Operating System: Antergos Linux
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 15.49GiB
 Name: xxx
 ID: xxx
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Username: nocive
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: true
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

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