This quick tip describes how to use your custom built docker images on OpenShift Online (Red Hat’s SaaS based container platform).
Create a new project and get login token
Login to OpenShift Online at https://manage.openshift.com/ and create a new project (for the sake of this demo I use “my-external-project” as the name for it).
Click of the question mark (upper right corner) and select “Command Line Tools”.
Then copy your access token into your clipboard according to the instructions shown.
Login to the OpenShift Online Docker Registry
Now login to the OpenShift Online Docker registry using the following command:
docker login -u YOUR_OPENSHIFT_ONLINE_USER -p YOUR_ACCESS_TOKEN https://registry.CLUSTER_ID.openshift.com:443
docker login -u firstname.lastname@example.org -p SECRET_TOKEN https://registry.rh-us-east-1.openshift.com:443
If the connection can be established you should receive a “Login succeeded” message.
Prepare your local image to be pushed
In this demo I will be using a the basic “hello-world” image provided by Docker. Firstly you will need to find out the image id:
Now we tag the image with a new repository id:
docker tag IMAGE_ID registry.CLUSTER_ID.openshift.com:443/PROJECT_NAME/hello-world
docker tag f2a91732366c registry.rh-us-east-1.openshift.com:443/my-external-project/hello-world
Now you should see the newly tagged image in your local registry:
Now we can directly push the image to the OpenShift Online registry (since we’ve authenticated before):
docker push registry.rh-us-east-1.openshift.com:443/my-external-project/hello-world
In the background OpenShift Online will import the image into its internal registry and will furthermore create an according image stream for it.
The resulting image stream can then be used to create a new deployment from that image. Click “Add to Project” and then “Deploy image”:
Have fun bringing your own Docker based applications onto OpenShift Online!