Overview
As described in the OpenShift documentation, ImageStreams are comprised of any number of container images that are identified by tags. Those individual tags are called ImageStreamTags. This document provides examples of the use of ImageStreamTags as input to and output from a build process.
ImageStreamTags as Build Input and Build Output
OpenShift Build Configurations can be setup to reference ImageStreamTags. Build Configurations created by use of the oc new-app command will do so by default. When a build configuration is being created, it first looks in the openshift namespace for an ImageStreamTag that matches the provided name. If it does not find one there, it will create one within your current namespace, and attempt to import the tag from Docker Hub. To view the source of your build configuration, click on Builds...Builds, click on the name of your build and click on the Configuration tab. You will see information similar to the picture below:
This build configuration is referencing the debian:buster-slim ImageStreamTag from the openshift namespace. If you wish to edit the source of your build configuration, click on Actions.. Edit from this screen. You will see a screen similar to the one below:
The 'Build From' section describes the input image used by the build configuration. The 'Push To' section displays the ImageStreamTag that will be produced by the build configuration.
Building your application from source will result in an image tag being added to the image stream. By default, OpenShift will deploy the latest tag from an image stream, which will most often correspond to the latest version of your application. You may wish to deploy a tag whose name indicates the version or purpose of the tag, such as v1.0 or branch-12345.
Retagging Images
Developers can make an explicit, descriptive tag of an image for storage and intentional deployment. Here is an example of that:
$ oc get istag
NAME DOCKER REF UPDATED
myapp:latest docker-registry.default.svc:5000/ckretler-sandbox/[email protected]:117cac1c39... 5 days ago
$ oc tag myapp:latest myapp:v0.1
Tag myapp:v0.1 set to [email protected]:117cac1c39...
$ oc get istag
NAME DOCKER REF UPDATED
myapp:latest docker-registry.default.svc:5000/ckretler-sandbox/[email protected]:117cac1c39... 5 days ago
myapp:v0.1 docker-registry.default.svc:5000/ckretler-sandbox/[email protected]:117cac1c39... 4 seconds ago
Here, we create a tag called v0.1, that is a copy of the latest tag. Subsequent builds will update the latest tag, but v0.1 will always reference docker image defined by sha 117cac1c39...