#!/bin/bash IMAGE_NAME=$(basename $(pwd)) echo "***" echo "*** creating an image from Dockerfile.v1 with name my_alpine" docker build . -f Dockerfile.v1 -t $IMAGE_NAME echo "***" echo "***listing all images" docker image ls read -n 1 -p "press any key to create an image with the same name from a slightly changed Dockerfile.v2" docker build . -f Dockerfile.v2 -t $IMAGE_NAME echo "***" echo "*** listing all images" docker image ls echo "***" echo "*** note the 'dangling' image named :" echo "*** to list only dangling images use: docker images --filter dangling=true" docker images --filter dangling=true