Red Hat Training

A Red Hat training course is available for Red Hat Container Development Kit

Chapter 9. Accessing the OpenShift Docker Registry

9.1. Docker Registry Overview

OpenShift provides an integrated Docker registry which can be used for development as well. Images present in the registry can directly be used for applications, speeding up the local development work-flow. Refer to Section 9.3, “Deploying an Application with Docker” to know more.

9.2. Registry Login

  1. Start Minishift and add the oc binary to the PATH. Refer to the section Chapter 1, Overview for details.
  2. Make sure your shell is configured to reuse the docker daemon.
  3. Login to the docker registry
~]$ docker login -u developer -p $(oc whoami -t) $(minishift openshift registry)

9.3. Deploying an Application with Docker

The following example shows how to deploy an OpenShift application directly from a locally built docker image. In this example, the OpenShift project myproject is used, as it is automatically created by minishift start.

  1. Make sure your shell is configured to reuse the Minishift docker daemon.
  2. Build the docker image as usual.
  3. Tag the image against the OpenShift registry.

    ~]$ docker tag my-app $(minishift openshift registry)/myproject/my-app
  4. Push the image to the registry to create an image stream with the same name as the application.

    ~]$ docker push $(minishift openshift registry)/myproject/my-app
  5. Create an application from the image stream and expose the service.

    ~]$ oc new-app --image-stream=my-app --name=my-app
    ~]$ oc expose service my-app