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