Skip to content

Docker compose stuck on stopping containers started with --attach-dependencies option #9494

Description

@sidz

Description
Docker compose stuck on stopping containers which are running with --attach-dependencies option. So it is only possible to kill them with docker compose kill in the separate tab and/or with double ta on Ctrl + C.

Steps to reproduce the issue:

  1. Define 3 services in the docker-compose.yaml with depends_on key. (example below)
  2. Up only php container with --attach-dependencies eg. docker compose up php --attach-dependencies
  3. Click on Ctrl + C or run docker compose kill in the separate tab
  4. Docker stops only php container and freezes on this step and don't stop others.

Describe the results you received:
Same issue on MacOS and Windows.

Any suggestions on how to debug this are welcome.

Describe the results you expected:
Expects that there won't be any freezes on stopping containers started with --attach-dependencies option

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

Output of docker compose version:

Docker Compose version v2.5.1

Output of docker info:

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  compose: Docker Compose (Docker Inc., v2.5.1)

Server:
 Containers: 39
  Running: 0
  Paused: 0
  Stopped: 39
 Images: 92
 Server Version: 20.10.12
 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: 
 runc version: 
 init version: 
 Security Options:
  apparmor
  seccomp
   Profile: default
 Kernel Version: 5.13.0-41-generic
 Operating System: Ubuntu 20.04.4 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 23.41GiB
 Name: sid
 ID: ULXA:3XFE:FTGL:CKAH:WTPB:5HTB:DQS6:IKL6:IBG7:YDWW:LYTZ:EAXA
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Additional environment details:
My docker-compose.yaml

version: "3.4"

services:
    php:
        build:
            context: docker/php
        volumes:
            - './:/var/www:rw,delegated'
        environment:
            APPLICATION_ENV: ${APPLICATION_ENV}
        depends_on:
            - memcache

    memcache:
        image: memcached:1.6-alpine
        restart: on-failure

    mailhog:
        image: mailhog/mailhog
        ports:
            - "127.0.0.1:8025:8025"

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