Signed-off-by: Jessica Frazelle <princess@docker.com>
| ... | ... |
@@ -1,6 +1,7 @@ |
| 1 | 1 |
package main |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
+ "fmt" |
|
| 4 | 5 |
"os/exec" |
| 5 | 6 |
"strings" |
| 6 | 7 |
|
| ... | ... |
@@ -102,6 +103,14 @@ func (s *DockerSuite) TestRmiImgIDForce(c *check.C) {
|
| 102 | 102 |
} |
| 103 | 103 |
out, _ = dockerCmd(c, "inspect", "-f", "{{.Id}}", "busybox-test")
|
| 104 | 104 |
imgID := strings.TrimSpace(out) |
| 105 |
+ |
|
| 106 |
+ // first checkout without force it fails |
|
| 107 |
+ runCmd = exec.Command(dockerBinary, "rmi", imgID) |
|
| 108 |
+ out, _, err = runCommandWithOutput(runCmd) |
|
| 109 |
+ if err == nil || !strings.Contains(out, fmt.Sprintf("Conflict, cannot delete image %s because it is tagged in multiple repositories, use -f to force", imgID)) {
|
|
| 110 |
+ c.Fatalf("rmi tagged in mutiple repos should have failed without force:%s, %v", out, err)
|
|
| 111 |
+ } |
|
| 112 |
+ |
|
| 105 | 113 |
dockerCmd(c, "rmi", "-f", imgID) |
| 106 | 114 |
{
|
| 107 | 115 |
imagesAfter, _ := dockerCmd(c, "images", "-a") |