|
@@ -193,6 +193,31 @@ func (s *DockerSuite) TestRmiWithMultipleRepositories(c *check.C) {
|
|
|
c.Assert(out, checker.Contains, "Untagged: "+newTag)
|
|
|
}
|
|
|
|
|
|
+func (s *DockerSuite) TestRmiForceWithMultipleRepositories(c *check.C) {
|
|
|
+ testRequires(c, DaemonIsLinux)
|
|
|
+ imageName := "rmiimage"
|
|
|
+ tag1 := imageName + ":tag1"
|
|
|
+ tag2 := imageName + ":tag2"
|
|
|
+
|
|
|
+ _, err := buildImage(tag1,
|
|
|
+ `FROM scratch
|
|
|
+ MAINTAINER "docker"`,
|
|
|
+ true)
|
|
|
+ if err != nil {
|
|
|
+ c.Fatal(err)
|
|
|
+ }
|
|
|
+
|
|
|
+ dockerCmd(c, "tag", tag1, tag2)
|
|
|
+
|
|
|
+ out, _ := dockerCmd(c, "rmi", "-f", tag2)
|
|
|
+ c.Assert(out, checker.Contains, "Untagged: "+tag2)
|
|
|
+ c.Assert(out, checker.Not(checker.Contains), "Untagged: "+tag1)
|
|
|
+
|
|
|
+ // Check built image still exists
|
|
|
+ images, _ := dockerCmd(c, "images", "-a")
|
|
|
+ c.Assert(images, checker.Contains, imageName, check.Commentf("Built image missing %q; Images: %q", imageName, images))
|
|
|
+}
|
|
|
+
|
|
|
func (s *DockerSuite) TestRmiBlank(c *check.C) {
|
|
|
testRequires(c, DaemonIsLinux)
|
|
|
// try to delete a blank image name
|