Permalink
Fetching contributors…
Cannot retrieve contributors at this time
64 lines (50 sloc) 1.98 KB

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 {project} and add the oc binary to the PATH. For a detailed example, see the {project} Quickstart section.

  2. Make sure your shell is configured to reuse the {project} docker daemon.

  3. Log into the OpenShift Docker registry.

     $ 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 {project} 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
Note

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:

$ oc run myapp --image 172.30.1.1:5000/myproject/myapp