6.7. Working with image streams
The following sections describe how to use image streams and image stream tags.
6.7.1. Getting information about image streams 复制链接链接已复制到粘贴板!
You can get general information about the image stream and detailed information about all the tags it is pointing to.
Procedure
Get general information about the image stream and detailed information about all the tags it is pointing to:
$ oc describe is/<image-name>For example:
$ oc describe is/pythonExample output
Name: python Namespace: default Created: About a minute ago Labels: <none> Annotations: openshift.io/image.dockerRepositoryCheck=2017-10-02T17:05:11Z Docker Pull Spec: docker-registry.default.svc:5000/default/python Image Lookup: local=false Unique Images: 1 Tags: 1 3.5 tagged from centos/python-35-centos7 * centos/python-35-centos7@sha256:49c18358df82f4577386404991c51a9559f243e0b1bdc366df25 About a minute agoGet all the information available about particular image stream tag:
$ oc describe istag/<image-stream>:<tag-name>For example:
$ oc describe istag/python:latestExample output
Image Name: sha256:49c18358df82f4577386404991c51a9559f243e0b1bdc366df25 Docker Image: centos/python-35-centos7@sha256:49c18358df82f4577386404991c51a9559f243e0b1bdc366df25 Name: sha256:49c18358df82f4577386404991c51a9559f243e0b1bdc366df25 Created: 2 minutes ago Image Size: 251.2 MB (first layer 2.898 MB, last binary layer 72.26 MB) Image Created: 2 weeks ago Author: <none> Arch: amd64 Entrypoint: container-entrypoint Command: /bin/sh -c $STI_SCRIPTS_PATH/usage Working Dir: /opt/app-root/src User: 1001 Exposes Ports: 8080/tcp Docker Labels: build-date=20170801
More information is output than shown.
6.7.2. Adding tags to an image stream 复制链接链接已复制到粘贴板!
You can add additional tags to image streams.
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>For example:
$ oc tag python:3.5 python:latestExample output
Tag python:latest set to python@sha256:49c18358df82f4577386404991c51a9559f243e0b1bdc366df25.Confirm the image stream 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.$ oc describe is/pythonExample output
Name: python Namespace: default Created: 5 minutes ago Labels: <none> Annotations: openshift.io/image.dockerRepositoryCheck=2017-10-02T17:05:11Z Docker Pull Spec: docker-registry.default.svc:5000/default/python Image Lookup: local=false Unique Images: 1 Tags: 2 latest tagged from python@sha256:49c18358df82f4577386404991c51a9559f243e0b1bdc366df25 * centos/python-35-centos7@sha256:49c18358df82f4577386404991c51a9559f243e0b1bdc366df25 About a minute ago 3.5 tagged from centos/python-35-centos7 * centos/python-35-centos7@sha256:49c18358df82f4577386404991c51a9559f243e0b1bdc366df25 5 minutes ago
6.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 tagcommand for all tag-related operations:$ oc tag <repository/image> <image-name:tag>For example, this command maps the
docker.io/python:3.6.0image to the3.6tag in thepythonimage stream.$ oc tag docker.io/python:3.6.0 python:3.6Example output
Tag python:3.6 set to docker.io/python:3.6.0.If the external image is secured, you must create a secret with credentials for accessing that registry.
6.7.4. Updating image stream tags 复制链接链接已复制到粘贴板!
You can update a tag to reflect another tag in an image stream.
Procedure
Update a tag:
$ oc tag <image-name:tag> <image-name:latest>For example, the following updates the
latesttag to reflect the3.6tag in an image stream:$ oc tag python:3.6 python:latestExample output
Tag python:latest set to python@sha256:438208801c4806548460b27bd1fbcb7bb188273d13871ab43f.
6.7.5. Removing image stream tags 复制链接链接已复制到粘贴板!
You can remove old tags from an image stream.
Procedure
Remove old tags from an image stream:
$ oc tag -d <image-name:tag>For example:
$ oc tag -d python:3.5Example output
Deleted tag default/python:3.5.
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 <repository/image> <image-name:tag> --scheduledFor example:
$ oc tag docker.io/python:3.6.0 python:3.6 --scheduledExample output
Tag python:3.6 set to import docker.io/python:3.6.0 periodically.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
--scheduledflag. This release_notes its behavior to default.$ oc tag <repositiory/image> <image-name:tag>