Accessing the OpenShift 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 workflow.

Logging Into the Registry

  1. Start Minishift and add the oc binary to the PATH. For a detailed example, see the Minishift Quickstart section.

  2. Make sure your shell is configured to reuse the Minishift docker daemon.

  3. Log into the OpenShift Docker registry.

    1. $ docker login -u developer -p $(oc whoami -t) $(minishift openshift registry)

Deploying Applications

The following example shows how to deploy an OpenShift application directly from a locally-built Docker image. This example uses the OpenShift project myproject. This project 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:

    1. $ 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:

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

    1. $ oc new-app --image-stream=my-app --name=my-app
    2. $ oc expose service my-app

If you want to deploy an application using oc run —image […​] then exposed internal registry route doesn’t work. You should use internal registry IP along with your project and app to deploy, as following:

  1. $ oc run myapp image 172.30.1.1:5000/myproject/myapp