Skip to content
This repository has been archived by the owner on Jun 11, 2019. It is now read-only.

Commit

Permalink
Merge pull request #15 from johnallen3d/support-image-digest-id
Browse files Browse the repository at this point in the history
Allow for Image Id's w/ sha256: Prefix
  • Loading branch information
mikljohansson committed Feb 23, 2016
2 parents 052e01b + 6c43800 commit 91eaf1b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ do
rm -f ContainerImageIdList
touch ContainerImageIdList
for CONTAINER_ID in ${CONTAINER_ID_LIST}; do
LINE=$(docker inspect ${CONTAINER_ID} | grep "\"Image\": \"[0-9a-fA-F]\{64\}\"")
LINE=$(docker inspect ${CONTAINER_ID} | grep "\"Image\": \"\(sha256:\)\?[0-9a-fA-F]\{64\}\"")
IMAGE_ID=$(echo ${LINE} | awk -F '"' '{print $4}')
echo "${IMAGE_ID}" >> ContainerImageIdList
done
Expand All @@ -89,7 +89,7 @@ do
arr=$(echo ${KEEP_IMAGES} | tr "," "\n")
for x in $arr
do
docker inspect $x | grep "\"Id\": \"[0-9a-fA-F]\{64\}\"" | head -1 | awk -F '"' '{print $4}' >> KeepImageIdList
docker inspect $x | grep "\"Id\": \"\(sha256:\)\?[0-9a-fA-F]\{64\}\"" | head -1 | awk -F '"' '{print $4}' >> KeepImageIdList
done
sort KeepImageIdList -o KeepImageIdList
comm -23 ToBeCleanedImageIdList KeepImageIdList > ToBeCleanedImageIdList2
Expand All @@ -113,7 +113,7 @@ do
rm -f ContainerImageIdList
touch ContainerImageIdList
for CONTAINER_ID in ${CONTAINER_ID_LIST}; do
LINE=$(docker inspect ${CONTAINER_ID} | grep "\"Image\": \"[0-9a-fA-F]\{64\}\"")
LINE=$(docker inspect ${CONTAINER_ID} | grep "\"Image\": \"\(sha256:\)\?[0-9a-fA-F]\{64\}\"")
IMAGE_ID=$(echo ${LINE} | awk -F '"' '{print $4}')
echo "${IMAGE_ID}" >> ContainerImageIdList
done
Expand Down

0 comments on commit 91eaf1b

Please sign in to comment.