Openshift new-app from local Docker image
Asked Answered
S

3

6


I'm trying to deploy on an Openshift Origin Pod an image which is available in my Docker repository:

$ docker images
REPOSITORY                                   TAG                 IMAGE ID            CREATED             SIZE
tomcat9demo                                  latest              535da1774da0        9 weeks ago         350.2 MB

When running:

$ oc new-app tomcat9demo --name tomcatdemo

Apparently it seems to find the image from the Docker repository:

--> Found Docker image 535da17 (9 weeks old) from  for "tomcat9demo:latest"

    * This image will be deployed in deployment config "tomcat9demo"
    * Port 8080/tcp will be load balanced by service "tomcat9demo"
      * Other containers can access this service through the hostname "tomcat9demo"
    * WARNING: Image "tomcat9demo:latest" runs as the 'root' user which may not be permitted by your cluster administrator

--> Creating resources with label app=tomcat9demo ...
    deploymentconfig "tomcat9demo" created
    service "tomcat9demo" created
--> Success

However the status shows an error. It seems there's an error with the image pull:

$ oc get pods
NAME                           READY     STATUS         RESTARTS   AGE
tomcat9demo-1-zrj98            0/1       ErrImagePull   0          16s
$ oc status
Error from server: the server could not find the requested resource

Do I need something else to grab the image from my local Docker repository ?

Silicone answered 5/4, 2017 at 15:26 Comment(5)
How are you running OpenShift? Using oc cluster up, minishift, or a remote OpenShift environment?Faddish
Thanks I'm running Openshift origin with "oc cluster up --version=latest"Silicone
Personally never found a backdoor for doing docker build and it being usable immediately. Technically believe you still need to expose the internal OpenShift registry and do a docker push into it.Faddish
@GrahamDumpleton any handy pointers on how to do that? Carla did you get this working?Middaugh
See #45625445Faddish
P
1

You need to specify the option --docker-image for it to point to your local image repo. Example:

oc new-app tomcat9demo --docker-image tomcat9demo

Pettifer answered 22/8, 2018 at 8:12 Comment(0)
L
0

You should add a tag to the local docker image.

docker build -t image_name .
docker tag image_name:<current tag ot just a latest> image_name:<new tag>
oc new-app mage_name:<new tag> --name=app_name

And you should see:

Found Docker image <your docker image id> (19 minutes old) from  for "image_name:<new tag>"
Lethargic answered 27/12, 2018 at 11:19 Comment(0)
L
0

Refer to this awesome youtube video, I was able to successfully deploy my local docker image onto the dedicated openshift platform's docker registry with the help of this: Push local docker images to openshift registry - minishift

Hope it helps.

Lafave answered 21/2, 2020 at 18:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.