Skip to content

Commit ac7004a

Browse files
committed
Unquote dangling image IDs to fix docker rmi cleanup
docker rmi --force "$(...)" quotes the list of dangling image IDs, which can collapse multiple IDs into a single argument and prevent cleanup from working correctly. Collect the IDs and pass them as separate arguments.
1 parent b050843 commit ac7004a

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

scripts/docker/docker.lib.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ function docker-build() {
5252
for version in $(_get-all-effective-versions) latest; do
5353
docker tag "${DOCKER_IMAGE}:$(_get-effective-version)" "${DOCKER_IMAGE}:${version}"
5454
done
55-
docker rmi --force "$(docker images | grep "<none>" | awk '{print $3}')" 2> /dev/null ||:
55+
local dangling_images="$(docker images -q -f dangling=true)"
56+
[[ -n "$dangling_images" ]] && docker rmi --force $dangling_images 2> /dev/null ||:
5657

5758
return 0
5859
}

0 commit comments

Comments
 (0)