Class ImageReference
java.lang.Object
org.springframework.boot.buildpack.platform.docker.type.ImageReference
A reference to a Docker image of the form
"imagename[:tag|@digest]".- Since:
- 2.3.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic ImageReferenceforJarFile(File jarFile) Create a newImageReferenceinstance deduced from a source JAR file that follows common Java naming conventions.Return the digest from the reference ornull.Return the domain for this image name.getName()Return the name of this image.getTag()Return the tag from the reference ornull.inthashCode()Return anImageReferencein the form"imagename:tag".Return anImageReferencecontaining either a tag or a digest.Return anImageReferencewithout the tag.static ImageReferenceCreate a newImageReferencefrom the given value.static ImageReferenceCreate a newImageReferencefrom the givenImageName.static ImageReferenceCreate a newImageReferencefrom the givenImageNameand tag.static ImageReferenceCreate a newImageReferencefrom the givenImageName, tag and digest.static ImageReferenceGenerate an image name with a random suffix.static ImageReferenceGenerate an image name with a random suffix.toString()withDigest(String digest) Create a newImageReferencewith an updated digest.
-
Method Details
-
getDomain
Return the domain for this image name.- Returns:
- the domain
- See Also:
-
getName
Return the name of this image.- Returns:
- the image name
- See Also:
-
getTag
Return the tag from the reference ornull.- Returns:
- the referenced tag
-
getDigest
Return the digest from the reference ornull.- Returns:
- the referenced digest
-
equals
-
hashCode
public int hashCode() -
toString
-
toLegacyString
-
withDigest
Create a newImageReferencewith an updated digest.- Parameters:
digest- the new digest- Returns:
- an updated image reference
-
inTaggedForm
Return anImageReferencein the form"imagename:tag". If the tag has not been defined thenlatestis used.- Returns:
- the image reference in tagged form
- Throws:
IllegalStateException- if the image reference contains a digest
-
inTaglessForm
Return anImageReferencewithout the tag.- Returns:
- the image reference in tagless form
- Since:
- 2.7.12
-
inTaggedOrDigestForm
Return anImageReferencecontaining either a tag or a digest. If neither the digest nor the tag has been defined then taglatestis used.- Returns:
- the image reference in tagged or digest form
-
forJarFile
Create a newImageReferenceinstance deduced from a source JAR file that follows common Java naming conventions.- Parameters:
jarFile- the source jar file- Returns:
- an
ImageNamefor the jar file.
-
random
Generate an image name with a random suffix.- Parameters:
prefix- the name prefix- Returns:
- a random image reference
-
random
Generate an image name with a random suffix.- Parameters:
prefix- the name prefixrandomLength- the number of chars in the random part of the name- Returns:
- a random image reference
-
of
Create a newImageReferencefrom the given value. The following value forms can be used:name(maps todocker.io/library/name)domain/namedomain:port/namedomain:port/name:tagdomain:port/name@digest
- Parameters:
value- the value to parse- Returns:
- an
ImageNameinstance
-
of
Create a newImageReferencefrom the givenImageName.- Parameters:
name- the image name- Returns:
- a new image reference
-
of
Create a newImageReferencefrom the givenImageNameand tag.- Parameters:
name- the image nametag- the referenced tag- Returns:
- a new image reference
-
of
Create a newImageReferencefrom the givenImageName, tag and digest.- Parameters:
name- the image nametag- the referenced tagdigest- the referenced digest- Returns:
- a new image reference
-