Skip to content

[BUG] compose run doesn't forward signals #10586

@raylu

Description

@raylu

Description

as mentioned in #8549 (comment), this doesn't seem to be working for docker compose (v2). the behavior works fine for docker-compose (v1), though

Steps To Reproduce

I ran @ndeloof's demo (from #8549 (comment)). had to comment some lines first:

$ git diff
diff --git a/demo/Dockerfile b/demo/Dockerfile
index a4058f8..6b4998c 100644
--- a/demo/Dockerfile
+++ b/demo/Dockerfile
@@ -3,9 +3,9 @@ FROM golang:1.18-alpine
 
 RUN apk add --no-cache openssh-client git
 RUN mkdir -p -m 0700 ~/.ssh && ssh-keyscan github.com >> ~/.ssh/known_hosts
-RUN --mount=type=ssh git clone [email protected]:ndeloof/toolbox.git
+#RUN --mount=type=ssh git clone [email protected]:ndeloof/toolbox.git
 
-RUN --mount=type=secret,id=mysecret cat /run/secrets/mysecret
+#RUN --mount=type=secret,id=mysecret cat /run/secrets/mysecret
 
 WORKDIR /app
 EXPOSE 5050
$ docker compose run --rm demo
press Ctrl+C to stop

in another shell,

$ ps x | grep compose
 8584 s000  S+     0:00.04 docker compose run --rm demo
 8585 s000  S+     0:00.02 /Applications/Docker.app/Contents/Resources/bin/com.docker.cli compose run --rm demo
 8587 s000  S+     0:00.03 /Users/raylu/.docker/cli-plugins/docker-compose compose run --rm demo

$ ps o pid,ppid,pgid | grep 858
 8584  9824  8584
 8585  8584  8584
 8587  8585  8584
# we see that all 3 processes are in the 8584 process group and we can signal them all at once

$ kill -- -8584
# nothing happens in the first shell

$ kill -- -8584

$ kill -- -8584
# ERRO[0123] got 3 SIGTERM/SIGINTs, forcing shutdown

$ docker ps
CONTAINER ID   IMAGE       COMMAND                  CREATED          STATUS        PORTS    NAMES
2f7a7691c1e3   truc-demo   "/demo"                  3 minutes ago    Up 3 minutes  5050/tcp truc_demo_run_bf3852cbe6ea

Compose Version

$ docker compose version
Docker Compose version v2.15.1

signals are forwarded just fine with v1 (docker-compose)

Docker Environment

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

Server:
 Containers: 10
  Running: 0
  Paused: 0
  Stopped: 10
 Images: 27
 Server Version: 20.10.11
 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: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 7b11cfaabd73bb80907dd23182b9347b4245eb5d
 runc version: v1.0.2-0-g52b36a2d
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
  cgroupns
 Kernel Version: 5.15.49-linuxkit
 Operating System: Ubuntu 20.04.6 LTS
 OSType: linux
 Architecture: aarch64
 CPUs: 6
 Total Memory: 19.52GiB
 Name: f62ba7ef2a4e
 ID: 24DZ:HGLP:2C7U:YTOU:M7RV:OI2I:JNTY:3SW2:3BVM:WJEY:PC3B:P4IE
 Docker Root Dir: /var/lib/docker
 Debug Mode: true
  File Descriptors: 24
  Goroutines: 40
  System Time: 2023-05-19T18:27:21.05660293Z
  EventsListeners: 0
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  registry:5005
  127.0.0.0/8
 Live Restore Enabled: false
 Product License: Community Engine

Anything else?

ndeloof's repro project is at https://github.com/ndeloof/truc

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions