Abraham Jaison
Abraham Jaison

Reputation: 509

How to run a docker image in openshift origin without building it via web console

I have a docker image developed and pushed onto the docker registry in openshift. Now I need to run the docker image as it is by passing some ENV variables. As shown below my docker image "mycustomdaemon:latest" was listed when I clicked "Add to project" link.

My Docker Image Listed in apps

However when I clicked on the image, it asked me to provide the build configuration and a Git repository URL as shown in the image below:

enter image description here

However I just need to run the image and do not want to rebuild it or perform any such actions. How would I be able to work around with it to simply run a Custom docker image created without performing any manipulation operations?

I tried to run the image directly from the CLI by issuing the oc new-app command but got the following error output.

error: can't look up Docker image "172.30.55.11:5000/default/mycustomdaemon:latest": Internal error occurred: Get https://172.30.55.11:5000/v2/: http: server gave HTTP response to HTTPS client error: no match for "172.30.55.11:5000/default/mycustomdaemon:latest"

error when issuing oc new-app command

oc get is command produces the following output:

output of oc get is command

Upvotes: 2

Views: 1369

Answers (1)

lvthillo
lvthillo

Reputation: 30723

For me worked the following on 1.2.0 First a I create a project in OpenShift in which I want to use my image.

$ oc new-project my-proj

Than I create an image-stream inside that project like described in here

$ oc project my-proj

Create the image-stream

$ oc create -f - <<API

apiVersion: v1

kind: ImageStream

metadata:

  annotations:

    description: Keeps track of changes in the application image

  name: myimage

API

name: contains the name of your image Than I tag my image. Authenticate on the openshift registry and push the image.

authenticate

$ docker login -u test -e [email protected] ....

tag my image:

$ docker tag original-image:latest 172.30.x.x/my-proj/myimage:latest

push the image

$ docker push 172.30.x.x/my-proj/myimage:latest

You can push from inside your environment (just use service-ip) or from outside (use the hostname of your secured registry).

After that I'm able to create a pod/container of my image inside my openshift project:

$ oc project my-proj
$ oc new-app my-proj/myimage:latest

Upvotes: 3

Related Questions