anchor.diff:  Preparation] for information.
   ====
   endif::[]
  +
  +Additionally there is an option to specify single tag use insecure repository.
  +To do that set `.importPolicy.insecure` in tag's definition to *true*:
  +
  +====
  +[source,yaml]
  +----
  +kind: ImageStream
  +apiVersion: v1
  +metadata:
  +  name: ruby
  +  tags:
  +  - from:
  +      kind: DockerImage
  +      name: my.repo.com:5000/myimage
  +    name: mytag
  +    importPolicy:
  +      insecure: "true" <1>
  +----
  +<1> Set tag ruby:mytag to use insecure connection to that registry.
  +====
  +
  +[[private-registries]]
  +
  +=== Importing Images from Private Registries
  +
  +An image stream can be configured to import tag and image metadata from private
  +image registries, requiring authentication.
  +
  +To configure this, you need to create a link:../dev_guide/secrets.html[`*secret*`]
  +which is used to store your credentials.
  +
  +. Create the `*secret*` first before importing image from the private repository:
  +
  +====
  +----
  +$ oc secrets new-dockercfg SECRET --docker-server=DOCKER_REGISTRY_SERVER --docker-username=DOCKER_USER --docker-password=DOCKER_PASSWORD --docker-email=DOCKER_EMAIL
  +----
  +====
  +
  +For other options consult with `oc secrets new --help`.
  +
  +Once the secret is configured proceed with creating new Image Stream or using
  +`oc import-image` command. During the import process OpenShift will pick up the
  +secrets and provide to the remote party.
  +
  +[[image-pull-policy]]
  +
  +=== Image Pull Policy
  +
  +Each container in a pod has a Docker image. Once you have created an image and
  +pushed it to a registry, you can then refer to it in the pod.
  +
  +When OpenShift creates containers, it uses the container's `*imagePullPolicy*`
  +to determine if the image should be pulled prior to starting the container.
  +There are three possible values for `*imagePullPolicy*`:
  +
  +- `*Always*` - always pull the image.
  +- `*IfNotPresent*` - only pull the image if it does not already exist on the node.
  +- `*Never*` - never pull the image.
  +
  +If a container's `*imagePullPolicy*`
  +parameter is not specified, OpenShift sets it based on the image's tag:
  +
  +. If the tag is *latest*, OpenShift defaults `*imagePullPolicy*` to `*Always*`.
  +. Otherwise, OpenShift defaults `*imagePullPolicy*` to `*IfNotPresent*`.
  
positive.code: .Image Stream Object Definition
  ====
  
  [source,json]
  ----
  {
    "kind": "ImageStream",
    "apiVersion": "v1",
    "metadata": {
      "name": "origin-ruby-sample",
      "namespace": "p1",
      "selfLink": "/osapi/v1/namesapces/p1/imageStreams/origin-ruby-sample",
      "uid": "480dfe73-f340-11e4-97b5-001c422dcd49",
      "resourceVersion": "293",
      "creationTimestamp": "2015-05-05T16:03:34Z",
      "labels": {
        "template": "application-template-stibuild"
      }
    },
    "spec": {},
    "status": {
      "dockerImageRepository": "172.30.30.129:5000/p1/origin-ruby-sample",
      "tags": [
        {
          "tag": "latest",
          "items": [
            {
              "created": "2015-05-05T16:05:47Z",
              "dockerImageReference": "172.30.30.129:5000/p1/origin-ruby-sample@sha256:4d3a646b58685449179a0c61ad4baa19a8df8ba668e0f0704b9ad16f5e16e642",
              "image": "sha256:4d3a646b58685449179a0c61ad4baa19a8df8ba668e0f0704b9ad16f5e16e642"
            }
          ]
        }
      ]
    }
  }
  ----
  
  ====
  
negative.code: .Image Stream Mapping Object Definition
  ====
  
  [source,yaml]
  ----
  apiVersion: v1
  kind: ImageStreamMapping
  metadata:
    creationTimestamp: null
    name: origin-ruby-sample
    namespace: test
  tag: latest
  image:
    dockerImageLayers:
    - name: sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef
      size: 0
    - name: sha256:ee1dd2cb6df21971f4af6de0f1d7782b81fb63156801cfde2bb47b4247c23c29
      size: 196634330
    - name: sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef
      size: 0
    - name: sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef
      size: 0
    - name: sha256:ca062656bff07f18bff46be00f40cfbb069687ec124ac0aa038fd676cfaea092
      size: 177723024
    - name: sha256:63d529c59c92843c395befd065de516ee9ed4995549f8218eac6ff088bfa6b6e
      size: 55679776
    - name: sha256:92114219a04977b5563d7dff71ec4caa3a37a15b266ce42ee8f43dba9798c966
      size: 11939149
    dockerImageMetadata:
      Architecture: amd64
      Config:
        Cmd:
        - /usr/libexec/s2i/run
        Entrypoint:
        - container-entrypoint
        Env:
        - RACK_ENV=production
        - OPENSHIFT_BUILD_NAMESPACE=test
        - OPENSHIFT_BUILD_SOURCE=https://github.com/openshift/ruby-hello-world.git
        - EXAMPLE=sample-app
        - OPENSHIFT_BUILD_NAME=ruby-sample-build-1
        - PATH=/opt/app-root/src/bin:/opt/app-root/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
        - STI_SCRIPTS_URL=image:///usr/libexec/s2i
        - STI_SCRIPTS_PATH=/usr/libexec/s2i
        - HOME=/opt/app-root/src
        - BASH_ENV=/opt/app-root/etc/scl_enable
        - ENV=/opt/app-root/etc/scl_enable
        - PROMPT_COMMAND=. /opt/app-root/etc/scl_enable
        - RUBY_VERSION=2.2
        ExposedPorts:
          8080/tcp: {}
        Labels:
          build-date: 2015-12-23
          io.k8s.description: Platform for building and running Ruby 2.2 applications
          io.k8s.display-name: 172.30.56.218:5000/test/origin-ruby-sample:latest
          io.openshift.build.commit.author: Ben Parees <bparees@users.noreply.github.com>
          io.openshift.build.commit.date: Wed Jan 20 10:14:27 2016 -0500
          io.openshift.build.commit.id: 00cadc392d39d5ef9117cbc8a31db0889eedd442
          io.openshift.build.commit.message: 'Merge pull request #51 from php-coder/fix_url_and_sti'
          io.openshift.build.commit.ref: master
          io.openshift.build.image: centos/ruby-22-centos7@sha256:3a335d7d8a452970c5b4054ad7118ff134b3a6b50a2bb6d0c07c746e8986b28e
          io.openshift.build.source-location: https://github.com/openshift/ruby-hello-world.git
          io.openshift.builder-base-version: 8d95148
          io.openshift.builder-version: 8847438ba06307f86ac877465eadc835201241df
          io.openshift.expose-services: 8080:http
          io.openshift.s2i.scripts-url: image:///usr/libexec/s2i
          io.openshift.tags: builder,ruby,ruby22
          io.s2i.scripts-url: image:///usr/libexec/s2i
          license: GPLv2
          name: CentOS Base Image
          vendor: CentOS
        User: "1001"
        WorkingDir: /opt/app-root/src
      Container: 86e9a4a3c760271671ab913616c51c9f3cea846ca524bf07c04a6f6c9e103a76
      ContainerConfig:
        AttachStdout: true
        Cmd:
        - /bin/sh
        - -c
        - tar -C /tmp -xf - && /usr/libexec/s2i/assemble
        Entrypoint:
        - container-entrypoint
        Env:
        - RACK_ENV=production
        - OPENSHIFT_BUILD_NAME=ruby-sample-build-1
        - OPENSHIFT_BUILD_NAMESPACE=test
        - OPENSHIFT_BUILD_SOURCE=https://github.com/openshift/ruby-hello-world.git
        - EXAMPLE=sample-app
        - PATH=/opt/app-root/src/bin:/opt/app-root/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
        - STI_SCRIPTS_URL=image:///usr/libexec/s2i
        - STI_SCRIPTS_PATH=/usr/libexec/s2i
        - HOME=/opt/app-root/src
        - BASH_ENV=/opt/app-root/etc/scl_enable
        - ENV=/opt/app-root/etc/scl_enable
        - PROMPT_COMMAND=. /opt/app-root/etc/scl_enable
        - RUBY_VERSION=2.2
        ExposedPorts:
          8080/tcp: {}
        Hostname: ruby-sample-build-1-build
        Image: centos/ruby-22-centos7@sha256:3a335d7d8a452970c5b4054ad7118ff134b3a6b50a2bb6d0c07c746e8986b28e
        OpenStdin: true
        StdinOnce: true
        User: "1001"
        WorkingDir: /opt/app-root/src
      Created: 2016-01-29T13:40:00Z
      DockerVersion: 1.8.2.fc21
      Id: 9d7fd5e2d15495802028c569d544329f4286dcd1c9c085ff5699218dbaa69b43
      Parent: 57b08d979c86f4500dc8cad639c9518744c8dd39447c055a3517dc9c18d6fccd
      Size: 441976279
      apiVersion: "1.0"
      kind: DockerImage
    dockerImageMetadataVersion: "1.0"
    dockerImageReference: 172.30.56.218:5000/test/origin-ruby-sample@sha256:47463d94eb5c049b2d23b03a9530bf944f8f967a0fe79147dd6b9135bf7dd13d
  ----
  ====
  
  