Skip to content

Commit e0b59ab

Browse files
committed
Enable sig-proxy by default in run and attach
1 parent a6a274f commit e0b59ab

3 files changed

Lines changed: 7 additions & 8 deletions

File tree

commands.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1324,7 +1324,7 @@ func (cli *DockerCli) CmdLogs(args ...string) error {
13241324
func (cli *DockerCli) CmdAttach(args ...string) error {
13251325
cmd := Subcmd("attach", "[OPTIONS] CONTAINER", "Attach to a running container")
13261326
noStdin := cmd.Bool("nostdin", false, "Do not attach stdin")
1327-
proxy := cmd.Bool("sig-proxy", false, "Proxify all received signal to the process (even in non-tty mode)")
1327+
proxy := cmd.Bool("sig-proxy", true, "Proxify all received signal to the process (even in non-tty mode)")
13281328
if err := cmd.Parse(args); err != nil {
13291329
return nil
13301330
}
@@ -1523,6 +1523,9 @@ func (cli *DockerCli) CmdRun(args ...string) error {
15231523
flSigProxy := cmd.Lookup("sig-proxy")
15241524
sigProxy, _ := strconv.ParseBool(flSigProxy.Value.String())
15251525
flName := cmd.Lookup("name")
1526+
if config.Tty {
1527+
sigProxy = false
1528+
}
15261529

15271530
var containerIDFile *os.File
15281531
if len(hostConfig.ContainerIDFile) > 0 {

container.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ var (
109109
ErrContainerStart = errors.New("The container failed to start. Unkown error")
110110
ErrContainerStartTimeout = errors.New("The container failed to start due to timed out.")
111111
ErrInvalidWorikingDirectory = errors.New("The working directory is invalid. It needs to be an absolute path.")
112-
ErrConflictTtySigProxy = errors.New("TTY mode (-t) already imply signal proxying (-sig-proxy)")
113112
ErrConflictAttachDetach = errors.New("Conflicting options: -a and -d")
114113
ErrConflictDetachAutoRemove = errors.New("Conflicting options: -rm and -d")
115114
)
@@ -167,7 +166,7 @@ func ParseRun(args []string, capabilities *Capabilities) (*Config, *HostConfig,
167166
flNetwork := cmd.Bool("n", true, "Enable networking for this container")
168167
flPrivileged := cmd.Bool("privileged", false, "Give extended privileges to this container")
169168
flAutoRemove := cmd.Bool("rm", false, "Automatically remove the container when it exits (incompatible with -d)")
170-
flSigProxy := cmd.Bool("sig-proxy", false, "Proxify all received signal to the process (even in non-tty mode)")
169+
cmd.Bool("sig-proxy", true, "Proxify all received signal to the process (even in non-tty mode)")
171170
cmd.String("name", "", "Assign a name to the container")
172171

173172
if capabilities != nil && *flMemory > 0 && !capabilities.MemoryLimit {
@@ -212,9 +211,6 @@ func ParseRun(args []string, capabilities *Capabilities) (*Config, *HostConfig,
212211
if *flWorkingDir != "" && !path.IsAbs(*flWorkingDir) {
213212
return nil, nil, cmd, ErrInvalidWorikingDirectory
214213
}
215-
if *flTty && *flSigProxy {
216-
return nil, nil, cmd, ErrConflictTtySigProxy
217-
}
218214
if *flDetach && *flAutoRemove {
219215
return nil, nil, cmd, ErrConflictDetachAutoRemove
220216
}

docs/sources/commandline/cli.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ To list available commands, either run ``docker`` with no parameters or execute
3030
Attach to a running container.
3131

3232
-nostdin=false: Do not attach stdin
33-
-sig-proxy=false: Proxify all received signal to the process (even in non-tty mode)
33+
-sig-proxy=true: Proxify all received signal to the process (even in non-tty mode)
3434

3535
You can detach from the container again (and leave it running) with
3636
``CTRL-c`` (for a quiet exit) or ``CTRL-\`` to get a stacktrace of
@@ -575,7 +575,7 @@ network communication.
575575
-entrypoint="": Overwrite the default entrypoint set by the image
576576
-w="": Working directory inside the container
577577
-lxc-conf=[]: Add custom lxc options -lxc-conf="lxc.cgroup.cpuset.cpus = 0,1"
578-
-sig-proxy=false: Proxify all received signal to the process (even in non-tty mode)
578+
-sig-proxy=true: Proxify all received signal to the process (even in non-tty mode)
579579
-expose=[]: Expose a port from the container without publishing it to your host
580580
-link="": Add link to another container (name:alias)
581581
-name="": Assign the specified name to the container. If no name is specific docker will generate a random name

0 commit comments

Comments
 (0)