Home Navigation

Thursday, 1 September 2022

Push image to OpenShift internal registry

Follow the below steps


Enable internal registry

oc patch configs.imageregistry.operator.openshift.io/cluster --patch '{"spec":{"defaultRoute":true}}' --type=merge

Get the internal registry 

oc get routes -n openshift-image-registry


Export the internal registry to an environmental variable

export REGISTRY=<The Registry URL you get from previous Command>

Login to the internal registry 

echo $(oc whoami -t) | docker login $REGISTRY -u $(oc whoami) --password-stdin

Build the docker image like below

docker build -t myimage:latest .

Tag your docker image with OpenShift registry

docker tag dashapp-grpc:latest $REGISTRY/<NAMESPACE>/myimage:latest

Push your docker image to OpenShift Internal Registry

docker push $REGISTRY/<NAMESPACE>/myimage:latest

Tag your image with OpenShift ImageStream

oc tag <NAMESPACE>/myimage:latest myimage:latest

List your ImageStream tags

oc get is

No comments:

Post a Comment