Command to check docker image size

I am using following command to build the image:

 $TOKEN = $(az acr login --name acr11908e1dv01.azurecr.io --expose-token --output tsv --query accessToken)
      
docker login acr11908e1dv01.azurecr.io -u 00000000-0000-0000-0000-000000000000 -p $TOKEN
      
cd ./Docker

docker image build --build-arg AUSER=$(AUSER) --build-arg APASS=$(APASS) --file Dockerfile . -t acr11908e1dv01.azurecr.io/docker-linux-agent:$(Build.BuildNumber)

if (("$(Build.SourceBranch)". ToLower(). Contains("master")) -or ("$(Build.SourceBranch)". ToLower(). Contains("develop")))
        {
           docker push acr11908e1dv01.azurecr.io/docker-linux-agent:$(Build.BuildNumber)
        }
      docker logout

amd then I am trying to use following command to check the size of the image which was developed using above command :slight_smile:

IMAGE_NAME=“acr11908e1dv01.azurecr.io/docker-linux-agent:$(Build.BuildNumber)”
TAG=“$(Build.BuildNumber)”
SIZE=$(docker images --format “{{. Size}}” ${IMAGE_NAME}😒{TAG})
echo “The size of the image ${IMAGE_NAME}😒{TAG} after build is ${SIZE}.”

But i am not fetching ant size. Please suggest how we can fetch size of the image in my case?

The command looks fine, except there’s a space after the dot in "{{.Size}}", without the space the command seems to work fine

After removing space also it is giving same message which is not giving size of the image

That message being what?

Below is the message:

The size of the image acr11908e1dv01.azurecr.io/docker-linux-agent:ubi9-11908-v1.0.58:ubi9-11908-v1.0.58 after build is .