Allow stopping of paused container
When a container is paused, signals are sent once the container has been unpaused. Instead of forcing the user to unpause a container before they can ever send a signal, allow the user to send the signals, and in the case of a stop signal, automatically unpause the container afterwards. This is much safer than unpausing the container first then sending a signal (what a user is currently forced to do), as the container may be paused for very good reasons and should not be unpaused except for stopping. Note that not even SIGKILL is possible while a process is paused, but it is killed the instant it is unpaused. Signed-off-by: Brian Goff <cpuguy83@gmail.com> Upstream-commit: c3feb046b9b1eb606cc7e853d020799eb3800e0e Component: engine
This commit is contained in:
@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/docker/docker/integration-cli/checker"
|
||||
"github.com/docker/docker/integration-cli/cli"
|
||||
@ -65,3 +66,13 @@ func (s *DockerSuite) TestPauseFailsOnWindowsServerContainers(c *check.C) {
|
||||
out, _, _ := dockerCmdWithError("pause", "test")
|
||||
c.Assert(out, checker.Contains, "cannot pause Windows Server Containers")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestStopPausedContainer(c *check.C) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
id := runSleepingContainer(c)
|
||||
cli.WaitRun(c, id)
|
||||
cli.DockerCmd(c, "pause", id)
|
||||
cli.DockerCmd(c, "stop", id)
|
||||
cli.WaitForInspectResult(c, id, "{{.State.Running}}", "false", 30*time.Second)
|
||||
}
|
||||
|
||||
@ -396,7 +396,7 @@ func runSleepingContainerInImage(c *check.C, image string, extraArgs ...string)
|
||||
args = append(args, extraArgs...)
|
||||
args = append(args, image)
|
||||
args = append(args, sleepCommandForDaemonPlatform()...)
|
||||
return cli.DockerCmd(c, args...).Combined()
|
||||
return strings.TrimSpace(cli.DockerCmd(c, args...).Combined())
|
||||
}
|
||||
|
||||
// minimalBaseImage returns the name of the minimal base image for the current
|
||||
|
||||
Reference in New Issue
Block a user