diff --git a/test/integration/api/rmi.bats b/test/integration/api/rmi.bats index 79960ba395..c8872438c3 100644 --- a/test/integration/api/rmi.bats +++ b/test/integration/api/rmi.bats @@ -102,3 +102,30 @@ function teardown() { [[ "${output}" != *"busybox"* ]] [[ "${output}" != *"testimage"* ]] } + +@test "docker rmi --force with image tag" { + start_docker_with_busybox 1 + start_docker 1 + + swarm_manage + + # make sure same image id have two repo-tags + docker_swarm tag busybox:latest testimage:tag1 + docker_swarm tag busybox:latest testimage:tag2 + + run docker_swarm images + [[ "${output}" == *"busybox"* ]] + [[ "${output}" == *"testimage"* ]] + [[ "${output}" == *"tag1"* ]] + [[ "${output}" == *"tag2"* ]] + + # test rmi with force + docker_swarm rmi -f testimage:tag1 + + # testimage:tag1 should be removed, testimage:tag2 should not + run docker_swarm images + [[ "${output}" == *"busybox"* ]] + [[ "${output}" == *"testimage"* ]] + [[ "${output}" != *"tag1"* ]] + [[ "${output}" == *"tag2"* ]] +}