mirror of https://github.com/docker/docs.git
fix image matching via id
Signed-off-by: Victor Vieux <vieux@docker.com>
This commit is contained in:
parent
e0b5e6f5fa
commit
56affa1ada
|
|
@ -43,6 +43,13 @@ func (image *Image) Match(IDOrName string, matchTag bool) bool {
|
|||
return true
|
||||
}
|
||||
|
||||
// trim sha256: and retry
|
||||
if parts := strings.SplitN(image.Id, ":", 2); len(parts) == 2 {
|
||||
if parts[1] == IDOrName || (size > 2 && strings.HasPrefix(parts[1], IDOrName)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
repoName, tag := ParseRepositoryTag(IDOrName)
|
||||
|
||||
// match repotag
|
||||
|
|
|
|||
|
|
@ -125,6 +125,20 @@ function teardown() {
|
|||
[[ "${output}" != *"sha256:649374debd26307573564fcf9748d39db33ef61fbf88ee84c3af10fd7e08765d"* ]]
|
||||
}
|
||||
|
||||
@test "docker rmi via id" {
|
||||
start_docker_with_busybox 1
|
||||
swarm_manage
|
||||
|
||||
# get busybox image id
|
||||
busybox_id=`docker_swarm images -q`
|
||||
|
||||
docker_swarm rmi $busybox_id
|
||||
|
||||
run docker_swarm images -q
|
||||
[ "$status" -eq 0 ]
|
||||
[ "${#lines[@]}" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "docker rmi --force with image tag" {
|
||||
start_docker_with_busybox 1
|
||||
start_docker 1
|
||||
|
|
|
|||
Loading…
Reference in New Issue