Ensure all the running containers are killed on daemon shutdown

Signed-off-by: Lei Jitang <leijitang@huawei.com>
Upstream-commit: bdb77078b5b93c3075aa258e1c04a5a5c893430f
Component: engine
This commit is contained in:
Lei Jitang
2015-05-27 09:09:25 +08:00
parent d9b5b5714d
commit 6aa7cf16be
2 changed files with 19 additions and 2 deletions
@@ -1165,3 +1165,19 @@ func (s *DockerDaemonSuite) TestRunContainerWithBridgeNone(c *check.C) {
c.Assert(strings.Contains(out, "eth0"), check.Equals, false,
check.Commentf("There shouldn't be eth0 in container when network is disabled: %s", out))
}
func (s *DockerDaemonSuite) TestDaemonRestartWithContainerRunning(t *check.C) {
if err := s.d.StartWithBusybox(); err != nil {
t.Fatal(err)
}
if out, err := s.d.Cmd("run", "-ti", "-d", "--name", "test", "busybox"); err != nil {
t.Fatal(out, err)
}
if err := s.d.Restart(); err != nil {
t.Fatal(err)
}
// Container 'test' should be removed without error
if out, err := s.d.Cmd("rm", "test"); err != nil {
t.Fatal(out, err)
}
}