mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #12654 from jfrazelle/12135-docker-delete-multiple-tagged
add regression test for rmi multiple tags without f
This commit is contained in:
commit
480d979c27
1 changed files with 9 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os/exec"
|
||||
"strings"
|
||||
|
||||
|
@ -102,6 +103,14 @@ func (s *DockerSuite) TestRmiImgIDForce(c *check.C) {
|
|||
}
|
||||
out, _ = dockerCmd(c, "inspect", "-f", "{{.Id}}", "busybox-test")
|
||||
imgID := strings.TrimSpace(out)
|
||||
|
||||
// first checkout without force it fails
|
||||
runCmd = exec.Command(dockerBinary, "rmi", imgID)
|
||||
out, _, err = runCommandWithOutput(runCmd)
|
||||
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)) {
|
||||
c.Fatalf("rmi tagged in mutiple repos should have failed without force:%s, %v", out, err)
|
||||
}
|
||||
|
||||
dockerCmd(c, "rmi", "-f", imgID)
|
||||
{
|
||||
imagesAfter, _ := dockerCmd(c, "images", "-a")
|
||||
|
|
Loading…
Reference in a new issue