Bootstrap FreeKB - OpenShift - List images using the oc get imagestreams command
OpenShift - List images using the oc get imagestreams command

Updated:   |  OpenShift articles

An image contains the code used to create a deployment. Then, a deployment can be created from an image, which should then create a replica set (which is the number of pods that should be created), and then the pods should be created.

An image stream doesn't have anything to do with "streaming" services like Spotify (to stream music) or Netflix (to stream movies). Instead, an image stream will list the images that have been used to deploy an application in your currently selected namespace.

The first time you deploy an application, the application should be pulled down from the online repository that contains the image, such as the registry.redhat.io online repository or the hub.docker.com online repository, and stored in your internal OpenShift registry, such as image-registry.openshift-image-registry.svc:5000. In the openshift-image-registry namespace, there should be an image-registry deployment that contains an environment variable REGISTRY_OPENSHIFT_SERVER_ADDR which will have the registry URL.

~]$ oc get deployment image-registry --namespace openshift-image-registry --output yaml
spec:
  template:
    spec:
      containers:
        env:
        - name: REGISTRY_OPENSHIFT_SERVER_ADDR
          value: image-registry.openshift-image-registry.svc:5000

 

The idea here is that if you have to redeploy an application, then then image is redeployed from the image stream, reducing the time is takes to deploy the image, since there is then no need to pull the image down from the online repository that contains the image, such as the registry.redhat.io online repository or the hub.docker.com online repository.

The oc get imagestreams command can be used to list the image that have been used to deploy an application in your currently selected namespace.

TIP

The -A or --all-namespaces flag can be used to list the image streams in every project / namespace.

The -n or --namespace flag can be used to list the image streams in a certain project / namespace.

~]$ oc get imagestreams --namespace openshift
NAME                                            IMAGE REPOSITORY                                                                                           TAGS                                                     UPDATED
apicast-gateway                                 image-registry.openshift-image-registry.svc:5000/openshift/apicast-gateway                                 2.1.0.GA,2.2.0.GA,2.3.0.GA,2.4.0.GA + 6 more...          3 months ago
apicurito-ui                                    image-registry.openshift-image-registry.svc:5000/openshift/apicurito-ui                                    1.2,1.3,1.4,1.5,1.6,1.7                                  3 months ago
cli                                             image-registry.openshift-image-registry.svc:5000/openshift/cli                                             latest                                                   2 weeks ago
cli-artifacts                                   image-registry.openshift-image-registry.svc:5000/openshift/cli-artifacts                                   latest                                                   2 weeks ago
dotnet                                          image-registry.openshift-image-registry.svc:5000/openshift/dotnet                                          2.1,2.1-el7,2.1-ubi8,3.1,3.1-el7 + 2 more...             3 months ago
php                                             image-registry.openshift-image-registry.svc:5000/openshift/php                                             7.2-ubi8,7.3-ubi7,7.3-ubi8,latest,7.2 + 1 more...        11 months ago

 

Let say you want to determine where the image stream name "php" is hosted. We can see that the PHP image is hosted on the registry.redhat.io online repository.

~]$ oc get imagestream/php --namespace openshift -o yaml | grep -i registry
      name: registry.redhat.io/rhscl/php-72-rhel7:latest
      name: registry.redhat.io/ubi8/php-72:latest
      name: registry.redhat.io/rhscl/php-73-rhel7:latest
      name: registry.redhat.io/ubi7/php-73:latest
      name: registry.redhat.io/ubi8/php-73:latest
  dockerImageRepository: image-registry.openshift-image-registry.svc:5000/openshift/php
      dockerImageReference: registry.redhat.io/rhscl/php-72-rhel7@sha256:382fe67f4319c2aa3eb1704a2ff09349adde8b17d287119ad4d25958358bc6d2
      dockerImageReference: registry.redhat.io/ubi8/php-72@sha256:c4d507741696e1b889e5e048701846450e5c723689f781b49eb3a87494fa7a6c
      dockerImageReference: registry.redhat.io/rhscl/php-73-rhel7@sha256:9bb7d5af155a162865ed10e33ea194f966b94974ce4cd6476f5fc26e5d2d8ff8
      dockerImageReference: registry.redhat.io/ubi7/php-73@sha256:5df897bb7e4a6c20ce6598e6a4f3c95e9a6fa2bc28e650eba3a42aa9316729f9
      dockerImageReference: registry.redhat.io/ubi8/php-73@sha256:ae3a2b9d09ff7356268d998ee325b7a6976e60cd2ae51614def4b1bcb1c80f7f
      dockerImageReference: registry.redhat.io/ubi8/php-73@sha256:ae3a2b9d09ff7356268d998ee325b7a6976e60cd2ae51614def4b1bcb1c80f7f
      dockerImageReference: registry.redhat.io/rhscl/php-73-rhel7@sha256:9bb7d5af155a162865ed10e33ea194f966b94974ce4cd6476f5fc26e5d2d8ff8

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 8f59fb in the box below so that we can be sure you are a human.