OpenShift Image and ImageStream Operations: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 61: Line 61:


  oc create -f ./green-is.yaml
  oc create -f ./green-is.yaml
====Image Available in an Docker Hub====
postgresql-95-debug.yaml:
apiVersion: v1
kind: ImageStream
metadata:
  name: postgresql-95-debug
spec:
  tags:
  - from:
      kind: DockerImage
      name: docker.io/ovidiufeodorov/postgresql-95-debug:1
    name: "1"
then:
oc create -f ./postgresql-95-debug.yaml


===Import Image Streams in Bulk===
===Import Image Streams in Bulk===

Revision as of 21:42, 5 December 2017

Internal

Overview

Image Operations

List Images available to the Project

oc get images

Image Stream Operations

Get Image Streams Available to a Project

oc project <project-name>
oc get imagestreams
oc get is
oc get is -n openshift

Get Information about an Image Stream

oc describe is jboss-eap64-openshift

Create an Image Stream

Create an Individual Image Stream with import-image

This command fetches the latest version of an image from a remote repository and updates the image stream tag if it does not match the previous value. It is idempotent, running the command multiple times will not create duplicate entries. When importing an image, only the image metadata is copied, not the image contents. If the image stream does not exist, the image stream is created if --confirm is provided.

oc import-image <imagestream-name>[:tag] \
   --from <registry/image> [--confirm]
oc import-image local-redhat-openjdk-18/openjdk18-openshift \
   --from=registry.access.redhat.com/redhat-openjdk-18/openjdk18-openshift --confirm

Create an Individual Image Stream from YAML/JSON

Image Available in an OpenShift Registry

Use an YAML file similar to:

apiVersion: v1
kind: ImageStream
metadata:
  name: green-is
spec:
  tags:
  - from:
      kind: DockerImage
      name: openshiftdemos/gogs:0.11.29
    name: 0.11.29

then:

oc create -f ./green-is.yaml

Image Available in an Docker Hub

postgresql-95-debug.yaml:

apiVersion: v1
kind: ImageStream
metadata:
  name: postgresql-95-debug
spec:
  tags:
  - from:
      kind: DockerImage
      name: docker.io/ovidiufeodorov/postgresql-95-debug:1
    name: "1"

then:

oc create -f ./postgresql-95-debug.yaml

Import Image Streams in Bulk

The following procedure will create a set of image streams in the "openshift" project. An example of image stream definition file is available at https://raw.githubusercontent.com/jboss-openshift/application-templates/master/jboss-image-streams.json. A version is also available here: OpenShift JBoss ImageStream Definition Example.

oc login -u system:admin
oc create -f ./jboss-image-streams.json -n openshift

The output is similar to:

imagestream "jboss-webserver31-tomcat7-openshift" created
imagestream "jboss-webserver31-tomcat8-openshift" created
imagestream "jboss-eap71-openshift" created
imagestream "jboss-decisionserver64-openshift" created
imagestream "jboss-processserver64-openshift" created
imagestream "jboss-datagrid71-openshift" created
imagestream "jboss-datagrid65-client-openshift" created
imagestream "jboss-datagrid71-client-openshift" created
imagestream "jboss-datavirt63-driver-openshift" created
imagestream "jboss-amq-63" created
imagestream "redhat-sso71-openshift" created
Error from server (AlreadyExists): imagestreams "jboss-webserver30-tomcat7-openshift" already exists
Error from server (AlreadyExists): imagestreams "jboss-webserver30-tomcat8-openshift" already exists
Error from server (AlreadyExists): imagestreams "jboss-eap64-openshift" already exists
Error from server (AlreadyExists): imagestreams "jboss-eap70-openshift" already exists 
Error from server (AlreadyExists): imagestreams "jboss-decisionserver62-openshift" already exists
Error from server (AlreadyExists): imagestreams "jboss-decisionserver63-openshift" already exists
Error from server (AlreadyExists): imagestreams "jboss-processserver63-openshift" already exists
Error from server (AlreadyExists): imagestreams "jboss-datagrid65-openshift" already exists
Error from server (AlreadyExists): imagestreams "jboss-datavirt63-openshift" already exists
Error from server (AlreadyExists): imagestreams "jboss-amq-62" already exists
Error from server (AlreadyExists): imagestreams "redhat-sso70-openshift" already exists
Error from server (AlreadyExists): imagestreams "redhat-openjdk18-openshift" already exists