简体   繁体   中英

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.

我的Docker映像已在应用程序中列出

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:

在此处输入图片说明

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"

发出oc new-app命令时出错

oc get is command produces the following output:

oc get的输出是命令

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 any@mail.com ....

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM