Carla
Carla

Reputation: 3380

Openshift new-app from local Docker image


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 ?

Upvotes: 6

Views: 11186

Answers (3)

Rakshit Singh
Rakshit Singh

Reputation: 169

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.

Upvotes: 0

Yegor Maksymchuk
Yegor Maksymchuk

Reputation: 1

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>"

Upvotes: 0

PARMESH
PARMESH

Reputation: 98

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

Upvotes: 1

Related Questions