#!/usr/bin/env bash docker ps > /dev/null 2>&1 if [ "$?" -ne 0 ]; then echo "Docker is not running correctly!"z exit 1 fi . env.sh existImageId=`docker images |grep "$IMAGE_NAME" |grep "$VERSION" |awk '{print $3}'` if [ -n "$existImageId" ]; then echo "Removing exist image: $existImageId" docker rmi "$existImageId" fi docker build --no-cache -t ajlx/"$IMAGE_NAME":"$VERSION" .