mirror of
https://github.com/docker/docker-bench-security.git
synced 2025-01-18 16:22:33 +01:00
Added check_images
Added check_images which moves the previous $imgList into this function and removed the else as this is handled within the main .sh Signed-off-by: Niall T <jammasterj89@gmail.com>
This commit is contained in:
parent
50bfd11df9
commit
4bb6e19965
1 changed files with 7 additions and 5 deletions
|
@ -1,19 +1,21 @@
|
|||
#!/bin/sh
|
||||
|
||||
check_images() {
|
||||
if [ -n "$imgList" ]; then
|
||||
pattern=$(echo "$imgList" | sed 's/,/ /g')
|
||||
for img in $pattern; do
|
||||
echo "Looking for image $img"
|
||||
sha256=$(docker image ls "$img" -q)
|
||||
sha256=$(docker images | grep $img | awk '{print $3}')
|
||||
if [ -z "$sha256" ]; then
|
||||
echo "Image $img not found. Exiting."
|
||||
exit 1
|
||||
fi
|
||||
images="$images $sha256 "
|
||||
done
|
||||
else
|
||||
images=$(docker images -q)
|
||||
images="$sha256"
|
||||
echo "images ------------------------------------ " $images
|
||||
echo "sha356" $sha256
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
check_4() {
|
||||
logit "\n"
|
||||
|
|
Loading…
Reference in a new issue