This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.이 콘텐츠는 선택한 언어로 제공되지 않습니다.
Chapter 5. Managing imagestreams
Imagestreams provide a means of creating and updating container images in an on-going way. As improvements are made to an image, tags can be used to assign new version numbers and keep track of changes. This document describes how image streams are managed.
5.1. Using imagestreams 링크 복사링크가 클립보드에 복사되었습니다!
An imagestream and its associated tags provide an abstraction for referencing container images from within OpenShift Container Platform. The imagestream and its tags allow you to see what images are available and ensure that you are using the specific image you need even if the image in the repository changes.
Imagestreams do not contain actual image data, but present a single virtual view of related images, similar to an image repository.
You can configure Builds and Deployments to watch an imagestream for notifications when new images are added and react by performing a Build or Deployment, respectively.
For example, if a Deployment is using a certain image and a new version of that image is created, a Deployment could be automatically performed to pick up the new version of the image.
However, if the imagestreamtag used by the Deployment or Build is not updated, then even if the container image in the container image registry is updated, the Build or Deployment will continue using the previous, presumably known good image.
The source images can be stored in any of the following:
- OpenShift Container Platform’s integrated registry.
-
An external registry, for example
registry.redhat.io
orhub.docker.com
. - Other imagestreams in the OpenShift Container Platform cluster.
When you define an object that references an imagestreamtag (such as a Build or Deployment configuration), you point to an imagestreamtag, not the Docker repository. When you Build or Deploy your application, OpenShift Container Platform queries the Docker repository using the imagestreamtag to locate the associated ID of the image and uses that exact image.
The imagestream metadata is stored in the etcd instance along with other cluster information.
Using imagestreams has several significant benefits:
- You can tag, rollback a tag, and quickly deal with images, without having to re-push using the command line.
- You can trigger Builds and Deployments when a new image is pushed to the registry. Also, OpenShift Container Platform has generic triggers for other resources, such as Kubernetes objects.
- You can mark a tag for periodic re-import. If the source image has changed, that change is picked up and reflected in the imagestream, which triggers the Build and/or Deployment flow, depending upon the Build or Deployment configuration.
- You can share images using fine-grained access control and quickly distribute images across your teams.
- If the source image changes, the imagestreamtag will still point to a known-good version of the image, ensuring that your application will not break unexpectedly.
- You can configure security around who can view and use the images through permissions on the imagestream objects.
- Users that lack permission to read or list images on the cluster level can still retrieve the images tagged in a project using imagestreams.
5.2. Configuring imagestreams 링크 복사링크가 클립보드에 복사되었습니다!
An imagestream object file contains the following elements.
Imagestream object definition
- 1
- The name of the imagestream.
- 2
- Docker repository path where new images can be pushed to add/update them in this imagestream.
- 3
- The SHA identifier that this imagestreamtag currently references. Resources that reference this imagestreamtag use this identifier.
- 4
- The SHA identifier that this imagestreamtag previously referenced. Can be used to rollback to an older image.
- 5
- The imagestreamtag name.
5.3. Imagestream images 링크 복사링크가 클립보드에 복사되었습니다!
An imagestream image points from within an imagestream to a particular image ID.
Imagestream images allow you to retrieve metadata about an image from a particular imagestream where it is tagged.
Imagestream image objects are automatically created in OpenShift Container Platform whenever you import or tag an image into the imagestream. You should never have to explicitly define an imagestream image object in any imagestream definition that you use to create imagestreams.
The imagestream image consists of the imagestream name and image ID from the repository, delimited by an @
sign:
<image-stream-name>@<image-id>
<image-stream-name>@<image-id>
To refer to the image in the imagestream object example, the imagestream image looks like:
origin-ruby-sample@sha256:47463d94eb5c049b2d23b03a9530bf944f8f967a0fe79147dd6b9135bf7dd13d
origin-ruby-sample@sha256:47463d94eb5c049b2d23b03a9530bf944f8f967a0fe79147dd6b9135bf7dd13d
5.4. Imagestreamtags 링크 복사링크가 클립보드에 복사되었습니다!
An imagestreamtag is a named pointer to an image in an imagestream. It is often abbreviated as istag. An imagestreamtag is used to reference or retrieve an image for a given imagestream and tag.
Imagestreamtags can reference any local or externally managed image. It contains a history of images represented as a stack of all images the tag ever pointed to. Whenever a new or existing image is tagged under particular image stream tag, it is placed at the first position in the history stack. The image previously occupying the top position will be available at the second position, and so forth. This allows for easy rollbacks to make tags point to historical images again.
The following imagestreamtag is from an imagestream object:
Imagestreamtag with two images in its history
Imagestreamtags can be permanent tags or tracking tags.
- Permanent tags are version-specific tags that point to a particular version of an image, such as Python 3.5.
Tracking tags are reference tags that follow another imagestreamtag and could be updated in the future to change which image they follow, much like a symlink. Note that these new levels are not guaranteed to be backwards-compatible.
For example, the
latest
imagestreamtags that ship with OpenShift Container Platform are tracking tags. This means consumers of thelatest
imagestreamtag will be updated to the newest level of the framework provided by the image when a new level becomes available. Alatest
imagestreamtag tov3.10
could be changed tov3.11
at any time. It is important to be aware that theselatest
image stream tags behave differently than the Dockerlatest
tag. Thelatest
image stream tag, in this case, does not point to the latest image in the Docker repository. It points to another imagestreamtag, which might not be the latest version of an image. For example, if thelatest
imagestreamtag points tov3.10
of an image, when the3.11
version is released, thelatest
tag is not automatically updated tov3.11
, and remains atv3.10
until it is manually updated to point to av3.11
imagestreamtag.NoteTracking tags are limited to a single imagestream and cannot reference other imagestreams.
You can create your own imagestreamtags for your own needs.
The imagestreamtag is composed of the name of the imagestream and a tag, separated by a colon:
<imagestream name>:<tag>
<imagestream name>:<tag>
For example, to refer to the sha256:47463d94eb5c049b2d23b03a9530bf944f8f967a0fe79147dd6b9135bf7dd13d
image in the imagestream object example earlier, the imagestreamtag would be:
origin-ruby-sample:latest
origin-ruby-sample:latest
5.5. Imagestream change triggers 링크 복사링크가 클립보드에 복사되었습니다!
Imagestream triggers allow your Builds and Deployments to be automatically invoked when a new version of an upstream image is available.
For example, Builds and Deployments can be automatically started when an image stream tag is modified. This is achieved by monitoring that particular image stream tag and notifying the Build or Deployment when a change is detected.
5.6. Imagestream mapping 링크 복사링크가 클립보드에 복사되었습니다!
When the integrated registry receives a new image, it creates and sends an image stream mapping to OpenShift Container Platform, providing the image’s project, name, tag, and image metadata.
Configuring imagestream mappings is an advanced feature.
This information is used to create a new image (if it does not already exist) and to tag the image into the imagestream. OpenShift Container Platform stores complete metadata about each image, such as commands, entry point, and environment variables. Images in OpenShift Container Platform are immutable and the maximum name length is 63 characters.
The following imagestream mapping example results in an image being tagged as test/origin-ruby-sample:latest:
Imagestream mapping object definition
5.7. Working with imagestreams 링크 복사링크가 클립보드에 복사되었습니다!
The following sections describe how to use imagestreams and imagestreamtags.
5.7.1. Getting information about imagestreams 링크 복사링크가 클립보드에 복사되었습니다!
You can get general information about the imagestream and detailed information about all the tags it is pointing to.
Procedure
Get general information about the imagestream and detailed information about all the tags it is pointing to:
oc describe is/<image-name>
$ oc describe is/<image-name>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow For example:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Get all the information available about particular imagestreamtag:
oc describe istag/<image-stream>:<tag-name>
$ oc describe istag/<image-stream>:<tag-name>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow For example:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
More information is output than shown.
5.7.2. Adding tags to an imagestream 링크 복사링크가 클립보드에 복사되었습니다!
You can add additional tags to imagestreams.
Procedure
Add a tag that points to one of the existing tags by using the
oc tag
command:oc tag <image-name:tag1> <image-name:tag2>
$ oc tag <image-name:tag1> <image-name:tag2>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow For example:
oc tag python:3.5 python:latest
$ oc tag python:3.5 python:latest Tag python:latest set to python@sha256:49c18358df82f4577386404991c51a9559f243e0b1bdc366df25.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Confirm the imagestream has two tags, one (
3.5
) pointing at the external container image and another tag (latest
) pointing to the same image because it was created based on the first tag.Copy to Clipboard Copied! Toggle word wrap Toggle overflow
5.7.3. Adding tags for an external image 링크 복사링크가 클립보드에 복사되었습니다!
You can add tags for external images.
Procedure
Add tags pointing to internal or external images, by using the
oc tag
command for all tag-related operations:oc tag <repository/image> <image-name:tag>
$ oc tag <repository/image> <image-name:tag>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow For example, this command maps the
docker.io/python:3.6.0
image to the3.6
tag in thepython
imagestream.oc tag docker.io/python:3.6.0 python:3.6
$ oc tag docker.io/python:3.6.0 python:3.6 Tag python:3.6 set to docker.io/python:3.6.0.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If the external image is secured, you must create a secret with credentials for accessing that registry.
5.7.4. Updating imagestreamtags 링크 복사링크가 클립보드에 복사되었습니다!
You can update a tag to reflect another tag in an imagestream.
Procedure
Update a tag:
oc tag <image-name:tag> <image-name:latest>
$ oc tag <image-name:tag> <image-name:latest>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow For example, the following updates the
latest
tag to reflect the3.6
tag in an imagestream:oc tag python:3.6 python:latest
$ oc tag python:3.6 python:latest Tag python:latest set to python@sha256:438208801c4806548460b27bd1fbcb7bb188273d13871ab43f.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
5.7.5. Removing imagestreamtags 링크 복사링크가 클립보드에 복사되었습니다!
You can remove old tags from an imagestream.
Procedure
Remove old tags from an imagestream:
oc tag -d <image-name:tag>
$ oc tag -d <image-name:tag>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow For example:
oc tag -d python:3.5
$ oc tag -d python:3.5 Deleted tag default/python:3.5.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
5.7.6. Configuring periodic importing of imagestreamtags 링크 복사링크가 클립보드에 복사되었습니다!
When working with an external container image registry, to periodically re-import an image, for example to get latest security updates, you can use the --scheduled
flag.
Procedure
Schedule importing images:
oc tag <repositiory/image> <image-name:tag> --scheduled
$ oc tag <repositiory/image> <image-name:tag> --scheduled
Copy to Clipboard Copied! Toggle word wrap Toggle overflow For example:
oc tag docker.io/python:3.6.0 python:3.6 --scheduled
$ oc tag docker.io/python:3.6.0 python:3.6 --scheduled Tag python:3.6 set to import docker.io/python:3.6.0 periodically.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow This command causes OpenShift Container Platform to periodically update this particular image stream tag. This period is a cluster-wide setting set to 15 minutes by default.
Remove the periodic check, re-run above command but omit the
--scheduled
flag. This will reset its behavior to default.oc tag <repositiory/image> <image-name:tag>
$ oc tag <repositiory/image> <image-name:tag>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow