Skip to content

Openshift Registry Setup

Setting up and Accessing the Openshift Registry#

Log in to Openshift.

Find the ip address of the registry:

Apparently you get it with defaults:

oc get svc -n default | grep registry

If you explicitly enable it you get it without defaults:

$ oc adm registry
--> Creating registry registry ...
    serviceaccount "registry" created "registry-registry-role" created "docker-registry" created
    service "docker-registry" created
--> Success

$ oc get svc
NAME              TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)    AGE
docker-registry   ClusterIP   <none>        5000/TCP   18m

You can also get it with:

oc get svc/docker-registry -o yaml | grep clusterIP:

Openshift works on routes so it had actually set everything up for me, and you can use the frontend for it.

Pushing an Image to the registry#

Ensure you have https it is at the correct TLS version 1.2+

Get your token (assuming you have logged into the cli)

oc whoami -t

Log into the registry using your token

docker login -u <username> -p <token_value> <registry_ip>:<port>

Tag the container:

A fully qualified docker image name should conform to the following format: <registry>/<repo>/<image>:<tag>

When mapping to OpenShift: <registry>/<project>/<imagestream>:<tag>

docker commit c16378f943fe my-api
docker tag my-api

Tag the remote repo in the image

docker tag my-api

Push the image to openshift

docker push

Important to note that my-project need not be created already

Key here is if you are using the openshift docker repo - you need to follow the specifications of that repo. For example the default docker repo does not require the my-project part.

oc new-project <my-project>

It seems like the project needs to exist