docker / cli

The Docker CLI
Apache License 2.0
4.91k stars 1.92k forks source link

terminate plugin process when docker-client process terminates #4332

Open fho opened 1 year ago

fho commented 1 year ago

Description

Hello,

I'm wondering if it is on purpose that a TERM signal sent to the docker client process does not terminate the plugin it started. This causes for example when running docker compose build and sending a TERM signal to the docker process` the compose plugin process continues to run.

Are there scenarions for plugins where it's desirable for the process continue running after the docker-client process has terminated? Or should SysProcAttr.Pdeathsig be actually set for the started plugins?

docker version:

$ docker version
Client:
 Version:           24.0.2
 API version:       1.43
 Go version:        go1.20.4
 Git commit:        cb74dfcd85
 Built:             Mon May 29 15:50:06 2023
 OS/Arch:           linux/amd64
 Context:           default

Server:
 Engine:
  Version:          24.0.2
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.20.4
  Git commit:       659604f9ee
  Built:            Mon May 29 15:50:06 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.7.1
  GitCommit:        1677a17964311325ed1c31e2c0a3589ce6d5c30d.m
 runc:
  Version:          1.1.7
  GitCommit:
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

docker info:

Client:
 Version:    24.0.2
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  0.10.5
    Path:     /usr/lib/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  2.18.1
    Path:     /usr/lib/docker/cli-plugins/docker-compose
  scan: Docker Scan (Docker Inc.)
    Version:  v0.1.0-280-gc7fa31d4c4
    Path:     /usr/lib/docker/cli-plugins/docker-scan

Server:
 Containers: 102
  Running: 0
  Paused: 0
  Stopped: 102
 Images: 150
 Server Version: 24.0.2
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: 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 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 1677a17964311325ed1c31e2c0a3589ce6d5c30d.m
 runc version:
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.3.5-arch1-1
 Operating System: Arch Linux
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 15.49GiB
 Name: ltop
 ID: KG5D:KMFV:DN27:F7AC:JLAN:USYW:MEB7:TXZQ:LASN:WAKE:OPJD:SULT
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Username: sisubot
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

How to Reproduce

Create the following executable bash-script to act as docker-plugin: ~/.docker/cli-plugins/docker-test

#!/usr/bin/env bash

sleep 50000

Related to: https://github.com/docker/compose/issues/10634#issuecomment-1573388511

thaJeztah commented 1 year ago

Possibly related to

fho commented 1 year ago

@thaJeztah thanks, that is actually same. Can I close this issue?

thaJeztah commented 1 year ago

That specific issue was when the "cloud integration" (which is provided by the compose-cli wrapper) is in use. It's possible that the same / similar issue exists in the docker cli itself.

Are you using Docker Desktop? If so, does the problem also occur if you use com.docker.cli compose build ? (com.docker.cli is the actual, "non-wrapped" docker CLI, so skipping the cloud-integration binary).

fho commented 1 year ago

That specific issue was when the "cloud integration" (which is provided by the compose-cli wrapper) is in use.

I see, different issue, thanks.

Are you using Docker Desktop?

No, I'm not using docker desktop.

thaJeztah commented 1 year ago

Thanks for checking; for completeness, could you edit your first comment, and include the output of;

docker version

and

docker info 
fho commented 1 year ago

@thaJeztah updated, also added instructions how it can be verified

thaJeztah commented 1 year ago

Thanks!