Skip to content

Interrupt signal is not proxied and "docker run" terminates #3801

Description

@enool

Description

Interrupt signal (SIGINT) is not proxied to the container when issued with
kill() to "docker run". Run command is terminated by the signal and container
is left running in the background.

This issue is seen on Linux when running a container attached with --tty (-t)
option and INT signal is sent from an external process with kill(). It's not
about CTRL+c INT that does indeed work as expected.

Embedding "docker run" in to software like editors is a bit tricky because of
this. For example, emacs compilation uses a tty by default, and it also
sends INT kill() instead of CTRL+c to the process group on "kill-compilation".

Pull request for moby/term: moby/term#31

Reproduce

docker run -it --rm --sig-proxy --init alpine sleep 3600
pkill --signal INT -f docker.*run.*sleep

Docker run dies and container is left behind

Expected behavior

Signal is proxied from docker run and container dies

docker version

Client:
Version: 20.10.17
API version: 1.41
Go version: go1.19.1
Git commit: 100c70180f
Built: Mon Sep 26 21:49:37 2022
OS/Arch: linux/amd64
Context: default
Experimental: true
Server:
Engine:
Version: 20.10.17
API version: 1.41 (minimum version 1.12)
Go version: go1.19.1
Git commit: a89b84221c
Built: Sat Oct 1 23:04:37 2022
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.6.8
GitCommit: 9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6
runc:
Version: 1.1.3
GitCommit: 6724737f999df9ee0d8ca5c6d7b81f97adc34374
docker-init:
Version: 0.19.0
GitCommit: de40ad007797e0dcd8b7126f27bb87401d224240

docker info

Client:
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc., v0.9.1)
Server:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 1
Server Version: 20.10.17
Storage Driver: fuse-overlayfs
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.runtime.v1.linux runc io.containerd.runc.v2
Default Runtime: runc
Init Binary: docker-init
containerd version: 9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6
runc version: 6724737f999df9ee0d8ca5c6d7b81f97adc34374
init version: de40ad007797e0dcd8b7126f27bb87401d224240
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 5.19.5-gentoo
Operating System: Gentoo Linux
OSType: linux
Architecture: x86_64
CPUs: 24
Total Memory: 31.29GiB
Name: deski
ID: AMHJ:VETK:BOAC:BVC3:RTZ2:LQJA:4H4H:IHA3:U3ZQ:23GQ:XNKE:YFCA
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
WARNING: No cpu cfs quota support
WARNING: No cpu cfs period support
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 Info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions