Problem Statement: My task was to determine whether the image I just pulled from Nexus is genuine or not corrupt due to a network problem or another issue.
There may be other ways to do this check, however I choose to use the Digest sh256 checksum.
I've added solution to this statement below in comments.
After some struggle i got the solution for this problem:
#!/bin/sh
NEXUS_URL=##NEXUS##
DOCKER_IMAGE_NAME="abc"
DOCKER_IMAGE_VER="1.0.0-1"
NEXUS_CHECKSUM=$(curl "https://$NEXUS_URL:5443/service/rest/v1/search?docker.imageTag=$DOCKER_IMAGE_VER&docker.imageName=$DOCKER_IMAGE_NAME" | grep "sha256" | awk '{print $3}' | sed 's/"//g')
PULLED_CHECKSUM=$(podman image ls --digests --format '{{.Digest}}' $NEXUS_URL:5000/tas/$DOCKER_IMAGE_NAME:$DOCKER_IMAGE_VER | cut -d ':' -f 2)
echo "$NEXUS_CHECKSUM : $PULLED_CHECKSUM"
if [[ $NEXUS_CHECKSUM==$PULLED_CHECKSUM ]];then
echo "Image is not courrupt"
else
echo "Image is Corrupt"
fi