#!/bin/bash DIR=$(cd "$(dirname "$BASH_SOURCE")" >/dev/null 2>&1 ; pwd -P ) #tags an image and pushes it to a repository # if not reposity is given will use docker.io and push to hub.docker.com # $1 name, $2 user(or repo), $3 repo [[ $# -lt 1 ]] && echo "image base name required" && exit [[ $1 == "-d" ]] && delete=true && shift 1 [[ $1 == "-f" ]] && force=true && shift 1 [[ $force ]] && docker rmi -f $(docker images -q $(./make-tag $@)) && exit 0 if [[ $delete ]];then id=$(docker images -q $(./make-tag $@)) docker rmi $(./make-tag $@) else docker tag $(./make-tag $1) $(./make-tag $2) id=$(docker images -q $(./make-tag $2)) fi echo tags after operation for image $id ./image-info -k RepoTags $id