Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenShift oc new-app IMAGE versus oc new-app --docker-image

The syntax for creating a new application on OpenShift based on a Docker image is a little confusing:

Usage:
  oc new-app (IMAGE | IMAGESTREAM | TEMPLATE | PATH | URL ...) [options]
. . .
Options:
  . . . 
  --docker-image=[]: Name of a Docker image to include in the app.
  . . .

What is the difference between specifying a docker image as the IMAGE argument and indicating the image in the --docker-image option?

Let's say my image is in docker hub (docker.io) and it is myid/myrepo:latest. Is the command below the correct way to create the application?

oc new-app myid/myrepo:latest --docker-image="docker.io/myid/myrepo:latest"

I'm using OpenShift v1.3.0.

like image 733
Paulo Merson Avatar asked Feb 06 '23 03:02

Paulo Merson


1 Answers

Because oc new-app overloads on the argument in:

(IMAGE | IMAGESTREAM | TEMPLATE | PATH | URL ...)

it can sometimes because of precedence order in the algorithm not choose the match you are after. The --docker-image option allows you to be explicit about what you want and bypass oc new-app trying to infer what you wanted. You do not need to supply both, so either of these should usually work:

oc new-app myid/myrepo:latest
oc new-app --docker-image myid/myrepo:latest

If the image is on Docker Hub Registry, you should be able to drop the docker.io as will search there by default. The hostname part for the registry should only be needed when using an alternate registry.

like image 116
Graham Dumpleton Avatar answered Mar 06 '23 21:03

Graham Dumpleton