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
- Author:
- Phillip Webb, Scott Frederick
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionboolean
static ImageReference
forJarFile
(File jarFile) Create a newImageReference
instance 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
.int
hashCode()
Return anImageReference
in the form"imagename:tag"
.Return anImageReference
containing either a tag or a digest.static ImageReference
Create a newImageReference
from the given value.static ImageReference
Create a newImageReference
from the givenImageName
.static ImageReference
Create a newImageReference
from the givenImageName
and tag.static ImageReference
Create a newImageReference
from the givenImageName
, tag and digest.static ImageReference
Generate an image name with a random suffix.static ImageReference
Generate an image name with a random suffix.toString()
withDigest
(String digest) Create a newImageReference
with 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 newImageReference
with an updated digest.- Parameters:
digest
- the new digest- Returns:
- an updated image reference
-
inTaggedForm
Return anImageReference
in the form"imagename:tag"
. If the tag has not been defined thenlatest
is used.- Returns:
- the image reference in tagged form
- Throws:
IllegalStateException
- if the image reference contains a digest
-
inTaggedOrDigestForm
Return anImageReference
containing either a tag or a digest. If neither the digest nor the tag has been defined then taglatest
is used.- Returns:
- the image reference in tagged or digest form
-
forJarFile
Create a newImageReference
instance deduced from a source JAR file that follows common Java naming conventions.- Parameters:
jarFile
- the source jar file- Returns:
- an
ImageName
for 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 newImageReference
from the given value. The following value forms can be used:name
(maps todocker.io/library/name
)domain/name
domain:port/name
domain:port/name:tag
domain:port/name@digest
- Parameters:
value
- the value to parse- Returns:
- an
ImageName
instance
-
of
Create a newImageReference
from the givenImageName
.- Parameters:
name
- the image name- Returns:
- a new image reference
-
of
Create a newImageReference
from the givenImageName
and tag.- Parameters:
name
- the image nametag
- the referenced tag- Returns:
- a new image reference
-
of
Create a newImageReference
from the givenImageName
, tag and digest.- Parameters:
name
- the image nametag
- the referenced tagdigest
- the referenced digest- Returns:
- a new image reference
-