Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
| ... | ... |
@@ -99,3 +99,23 @@ func TestRmiTagWithExistingContainers(t *testing.T) {
|
| 99 | 99 |
|
| 100 | 100 |
logDone("rmi - delete tag with existing containers")
|
| 101 | 101 |
} |
| 102 |
+ |
|
| 103 |
+func TestRmiForceWithExistingContainers(t *testing.T) {
|
|
| 104 |
+ image := "busybox-clone" |
|
| 105 |
+ if out, _, err := runCommandWithOutput(exec.Command(dockerBinary, "build", "--no-cache", "-t", image, "/docker-busybox")); err != nil {
|
|
| 106 |
+ t.Fatalf("Could not build %s: %s, %v", image, out, err)
|
|
| 107 |
+ } |
|
| 108 |
+ |
|
| 109 |
+ if out, _, err := runCommandWithOutput(exec.Command(dockerBinary, "run", "--name", "test-force-rmi", image, "/bin/true")); err != nil {
|
|
| 110 |
+ t.Fatalf("Could not run container: %s, %v", out, err)
|
|
| 111 |
+ } |
|
| 112 |
+ |
|
| 113 |
+ out, _, err := runCommandWithOutput(exec.Command(dockerBinary, "rmi", "-f", image)) |
|
| 114 |
+ if err != nil {
|
|
| 115 |
+ t.Fatalf("Could not remove image %s: %s, %v", image, out, err)
|
|
| 116 |
+ } |
|
| 117 |
+ |
|
| 118 |
+ deleteAllContainers() |
|
| 119 |
+ |
|
| 120 |
+ logDone("rmi - force delete with existing containers")
|
|
| 121 |
+} |