Chapter 9. Accessing the OpenShift Docker Registry
9.1. Docker Registry Overview Copy linkLink copied to clipboard!
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 Copy linkLink copied to clipboard!
-
Start Minishift and add the
oc
binary to the PATH. Refer to the section Chapter 1, Overview for details. - Make sure your shell is configured to reuse the docker daemon.
- Login to the docker registry
docker login -u developer -p $(oc whoami -t) $(minishift openshift registry)
~]$ docker login -u developer -p $(oc whoami -t) $(minishift openshift registry)
9.3. Deploying an Application with Docker Copy linkLink copied to clipboard!
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
.
- Make sure your shell is configured to reuse the Minishift docker daemon.
- Build the docker image as usual.
Tag the image against the OpenShift registry.
docker tag my-app $(minishift openshift registry)/myproject/my-app
~]$ docker tag my-app $(minishift openshift registry)/myproject/my-app
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 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
~]$ docker push $(minishift openshift registry)/myproject/my-app
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 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
~]$ oc new-app --image-stream=my-app --name=my-app ~]$ oc expose service my-app
Copy to Clipboard Copied! Toggle word wrap Toggle overflow