func GetTagFromNamedRef(ref distreference.Named) string {
	var tag string
	switch x := ref.(type) {
	case distreference.Digested:
		tag = x.Digest().String()
	case distreference.NamedTagged:
		tag = x.Tag()
	default:
		tag = "latest"
	}
	return tag
}
GetTagFromNamedRef returns a tag from the specified reference.
This function is necessary as long as the docker "server" api makes the distinction between repository
and tags.
package reference
import (
	distreference "github.com/docker/distribution/reference"
)
func Parse(ref string) (string, string, error) {
	distributionRef, err := distreference.ParseNamed(ref)
	if err != nil {
		return "", "", err
	}
	tag := GetTagFromNamedRef(distributionRef)
	return distributionRef.Name(), tag, nil
}