Highlighted
Cadet
Cadet
  • 284 Views

oc new-app --docker-image vs oc create deployment image

Jump to solution

So I am studying the ex280, and in the material most of the time they use oc new-app --docker-image quay_url except in one exercise they used following:

Create a new application named hello using the container located at quay.io/redhattraining/hello-world-nginx:v1.0

oc create deployment hello --image quay.io/redhattraining/hello-world-nginx:v1.0

so the concern here, how to know when to use the oc create deployment rather than oc new-app? Note I tried the command "oc new-app --name  hello --docker-image quay.io/redhattraining/hello-world-nginx:v1.0" but it didnt work.

Labels (3)
0 Kudos
1 Solution

Accepted Solutions
Highlighted
Flight Engineer
Flight Engineer
  • 218 Views

Re: oc new-app --docker-image vs oc create deployment image

Jump to solution

Hi TheHero

I completely agree, that sentence may be misleading.

Just adding one note: the term "application" in OpenShift (and in Kubernetes in general) is somehow overloaded.

When talking about resources, an "application" is just a bunch of resources with the same value for the "app" label. In other contexts, "application" refers to the set of program components deployed with a common purpose. 

But, again, I agree with you that the sentence can be improved.

KR

Jordi Sola 

View solution in original post

Reply
Loading...
3 Replies
Highlighted
Flight Engineer
Flight Engineer
  • 269 Views

Re: oc new-app --docker-image vs oc create deployment image

Jump to solution

Hi TheHero!

The main difference between using "oc new-app" and "oc create deployment" is the number of resources created.

"oc create deployment" creates a "DeploymentConfiguration" resource, getting the image from the registry (quay.io in this case) and deploying as needed (i.e. one replica by default).

"oc new-app" creates a bunch of resources. In this case, as you are providing an image, it creates the "DeploymentConfiguration", the "ImageStream" and the "Service" needed to develop and manage the application itself (note the associated route is not created by default). 

Other "oc new-app" variants may create more resources (i.e. if the source code is provided, "BuildConfig" resources are created).

So, responding to your question, using "oc new-app" is more common and useful for creating a new application from source code or images. Use "oc create deployment" if you need to update an existing application with new deployments, or need fine-grained control on your application resources.

 

Hope that helps.

KR

Jordi Sola

Reply
Loading...
Highlighted
Cadet
Cadet
  • 247 Views

Re: oc new-app --docker-image vs oc create deployment image

Jump to solution

thanks a lot for the great explanation Smiley Happy.

So correct me if I am wrong, I would assume they should be more accurate with the question phrase, because based on the question statement  "Create a new application named hello using the container located at quay.io/redhattraining/hello-world-nginx:v1.0"  the first thing came up in my mind to use "oc new-app" command, but it didnt work, they should mention "create deployment configuration"  rather  "create new app" in the question.

Again thanks a lot, I feel more comfortable with your explanation.

 

 

0 Kudos
Reply
Loading...
Highlighted
Flight Engineer
Flight Engineer
  • 219 Views

Re: oc new-app --docker-image vs oc create deployment image

Jump to solution

Hi TheHero

I completely agree, that sentence may be misleading.

Just adding one note: the term "application" in OpenShift (and in Kubernetes in general) is somehow overloaded.

When talking about resources, an "application" is just a bunch of resources with the same value for the "app" label. In other contexts, "application" refers to the set of program components deployed with a common purpose. 

But, again, I agree with you that the sentence can be improved.

KR

Jordi Sola 

View solution in original post

Reply
Loading...
Join the discussion
You must log in to join this conversation.