Skip to content

docker client doesn't pass signals when a terminal is attached #28872

@jarro2783

Description

@jarro2783

Description

Re #3793: when running with -ti, docker run does not pass signals to child process.

Steps to reproduce the issue:

  1. I built an image FROM base/archlinux, with https://github.com/krallin/tini in it.

  2. docker run -ti tini-arch /tini -- sleep 300

  3. ps -A f | grep docker

     31807 pts/5    Sl+    0:00              |   |   |   \_ docker run -ti tini-arch /tini -- sleep 300
    
  4. kill 31807

Describe the results you received:

In the terminal window attached I see

Terminated

In another window:

docker ps
CONTAINER ID        IMAGE               COMMAND                CREATED             STATUS              PORTS               NAMES
94e81d8dd7db        tini-arch           "/tini -- sleep 300"   59 seconds ago      Up 58 seconds                           angry_ardinghelli

Describe the results you expected:

I expect the container to stop running because it has been passed the appropriate signal. I have confirmed that running the same without -ti prints nothing in the attached terminal, and docker ps shows that the running container has stopped.

This is necessary because I expect that in situations like running a container over an SSH session should terminate the container if the SSH session hangs up, because SIGHUP will be sent to the client when the terminal closes.

Output of docker version:

Client:
 Version:      1.11.0
 API version:  1.23
 Go version:   go1.6.1
 Git commit:   4dc5990
 Built:        
 OS/Arch:      linux/amd64

Server:
 Version:      1.11.0
 API version:  1.23
 Go version:   go1.6.1
 Git commit:   4dc5990
 Built:        
 OS/Arch:      linux/amd64

Output of docker info:

Containers: 19
 Running: 0
 Paused: 0
 Stopped: 19
Images: 206
Server Version: 1.11.0
Storage Driver: overlay
 Backing Filesystem: extfs
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins: 
 Volume: local
 Network: bridge null host
Kernel Version: 4.4.6-gentoo
Operating System: Gentoo/Linux
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 3.829 GiB
Name: guepardo
ID: Y6HO:RPCY:TMYW:63IN:CQP2:I4JY:6EUL:AYHK:HBH2:JK7U:YCYJ:ODTY
Docker Root Dir: /var/lib/docker
Debug mode (client): false
Debug mode (server): false
Username: jarro2783
Registry: https://index.docker.io/v1/
WARNING: No cpu cfs quota support
WARNING: No cpu cfs period support

Additional environment details (AWS, VirtualBox, physical, etc.):

Physical machine. I have confirmed this on another physical host running 1.12.0.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions