docker / docker/cli

terminate plugin process when docker-client process terminates

Open
#4,332 7 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/plugins kind/bug status/0-triage
Dominant language
Go
Stars
6.1k
Forks
2.2k
Avg merge
1d 15h
Merged PRs (30d)
43

Description

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
  • run docker test
  • send a TERM signal to the docker test process
  • check if the .docker/cli-plugins/docker-test process still runs, it does

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the Docker CLI's plugin process startup and signal-handling path, using the docker test reproduction and the SysProcAttr.Pdeathsig question as the scope. Verify whether terminating docker test should terminate .docker/cli-plugins/docker-test, and check relevant process-lifecycle tests if present. Done means the intended behavior is implemented and covered by a regression test, or clearly documented if plugins should survive.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.