Skip to content

docker compose kill command ignores COMPOSE_IGNORE_ORPHANS #9742

@theswordsmahin

Description

@theswordsmahin

Description
I have several different directories with separate compose files. For each directory, i specify the same COMPOSE_PROJECT_NAME.
Running docker compose down with COMPOSE_IGNORE_ORPHANS=true works as expected and only removes containers for services within the current directory. docker compose kill however removes all other containers that were started.

Steps to reproduce the issue:

  1. Make 2 directories, each with a separate docker-compose.yaml file (with different service names) and .env file. Specify the same COMPOSE_PROJECT_NAME and COMPOSE_IGNORE_ORPHANS=true in each .env file
  2. Run docker compose up in one directory.
  3. Run docker compose kill in the other directory.

Describe the results you received:
Containers started from the first directory are killed.

Describe the results you expected:
Containers from first directory remain running

Additional information you deem important (e.g. issue happens only occasionally):
docker compose down and docker compose rm seem to behave as intended.

Output of docker compose version:

$ > docker compose version
Docker Compose version v2.7.0

Output of docker info:

$ > docker info
Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc., v0.8.2)
  compose: Docker Compose (Docker Inc., v2.7.0)
  extension: Manages Docker extensions (Docker Inc., v0.2.8)
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc., 0.6.0)
  scan: Docker Scan (Docker Inc., v0.17.0)

Server:
 Containers: 8
  Running: 1
  Paused: 0
  Stopped: 7
 Images: 42
 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:
  seccomp
   Profile: default
 Kernel Version: 5.10.102.1-microsoft-standard-WSL2
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 11.69GiB
 Name: docker-desktop
 ID: LQKT:FWLX:JK6C:4MFA:SZLG:KUIO:GL6Q:HOFT:HAPG:BQOR:GIT6:2Q75
 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

WARNING: No blkio throttle.read_bps_device support
WARNING: No blkio throttle.write_bps_device support
WARNING: No blkio throttle.read_iops_device support
WARNING: No blkio throttle.write_iops_device support

Additional environment details:

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