{"id":50034,"date":"2025-07-10T11:05:22","date_gmt":"2025-07-10T11:05:22","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=50034"},"modified":"2025-07-12T05:56:28","modified_gmt":"2025-07-12T05:56:28","slug":"openshift-build-your-application-from-a-container-image","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/openshift-build-your-application-from-a-container-image\/","title":{"rendered":"Openshift: Lab 12 &#8211; Build your application from a container image"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">In this lesson, you will:<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Set up your Developer Sandbox<\/li>\n\n\n\n<li>Set up a cluster<\/li>\n\n\n\n<li>Build the application from a container image<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Build the application from a container image<\/h3>\n\n\n\n<p>To build your application from a container image, switch to the&nbsp;<strong>Developer<\/strong>&nbsp;view in your OpenShift dashboard (Figure 8):<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/developers.redhat.com\/sites\/default\/files\/Figure2dashboarddevelopermode.png\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" src=\"https:\/\/developers.redhat.com\/sites\/default\/files\/styles\/article_floated\/public\/Figure2dashboarddevelopermode.png?itok=7SI5NtrY\" alt=\"The Developer view in your OpenShift dashboard.\"\/><\/a><figcaption class=\"wp-element-caption\">Figure 2: The Developer view in your OpenShift dashboard.<\/figcaption><\/figure>\n\n\n\n<p>Next, select&nbsp;<strong>+Add<\/strong>&nbsp;to display the many options available for adding an application to your cluster (Figure 9).<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/developers.redhat.com\/sites\/default\/files\/Figure3developer_add.png\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" src=\"https:\/\/developers.redhat.com\/sites\/default\/files\/styles\/article_floated\/public\/Figure3developer_add.png?itok=zIjvj3j1\" alt=\"Select\u00a0+Add to display the available options.\"\/><\/a><figcaption class=\"wp-element-caption\">Figure 3: Select&nbsp;+Add to display the available options.<\/figcaption><\/figure>\n\n\n\n<p>In our case, we are interested in the&nbsp;<strong>Git Repository\/Import from Git<\/strong>&nbsp;option. Select&nbsp;<strong>Import from Git<\/strong>&nbsp;(Figure 10).<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/developers.redhat.com\/sites\/default\/files\/Figure4import_from_git.png\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" src=\"https:\/\/developers.redhat.com\/sites\/default\/files\/styles\/article_floated\/public\/Figure4import_from_git.png?itok=lWyHnaTg\" alt=\"Selecting Import from Git will build an application from your source code.\"\/><\/a><figcaption class=\"wp-element-caption\">Figure 4: Selecting Import from Git will build an application from your source code.<\/figcaption><\/figure>\n\n\n\n<p>You will be prompted to enter a URL that points to a Git repo. This is where things get interesting. OpenShift will copy the repo to an internal storage location, inspect it, and attempt to discern the import strategy to build it.<\/p>\n\n\n\n<p>OpenShift will choose one of the following methods to build the application:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Option 1<\/strong>: Using the Builder image\u00a0for the programming language used (i.e., the s2i option).<\/li>\n\n\n\n<li><strong>Option 2<\/strong>: Using the Dockerfile that is found in the Git repo.<\/li>\n\n\n\n<li><strong>Option 3<\/strong>: Using the DevFile that is found in the Git Repo.<\/li>\n<\/ul>\n\n\n\n<p>Again, we\u2019re focusing on Option 1 right now: Using the Builder image and the s2i technology. The Builder image is determined by inspecting the source code and may be .NET, JBoss, Perl, or one of several other options.<\/p>\n\n\n\n<p>Here are some URLs of sample code that you can use for their related languages:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>C# (.NET):\u00a0<a href=\"https:\/\/github.com\/redhat-developer-demos\/csharp_mvc.git\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/redhat-developer-demos\/csharp_mvc.git<\/a><\/li>\n\n\n\n<li>Go:\u00a0<a href=\"https:\/\/github.com\/redhat-developer-demos\/sandbox-go.git\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/redhat-developer-demos\/sandbox-go.git<\/a><\/li>\n\n\n\n<li>Node.js:\u00a0<a href=\"https:\/\/github.com\/redhat-developer-demos\/sandbox-nodejs.git\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/redhat-developer-demos\/sandbox-nodejs.git<\/a><\/li>\n\n\n\n<li>PHP:\u00a0<a href=\"http:\/\/github.com\/redhat-developer-demos\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/github.com\/redhat-developer-demos\/sandbox-php.git<\/a>\u00a0<\/li>\n\n\n\n<li>Python:\u00a0<a href=\"https:\/\/developers.redhat.com\/learning\/learn:openshift:get-started-your-developer-sandbox\/resource\/github.com\/redhat-developer-demos\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/github.com\/redhat-developer-demos\/sandbox-python.git<\/a><\/li>\n\n\n\n<li>Ruby:\u00a0<a href=\"https:\/\/github.com\/redhat-developer-demos\/sandbox-ruby.git\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/redhat-developer-demos\/sandbox-ruby.git<\/a><\/li>\n<\/ul>\n\n\n\n<p>Select the Container images option (Figure 11).<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/developers.redhat.com\/sites\/default\/files\/Figure7container_images_option.png\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" src=\"https:\/\/developers.redhat.com\/sites\/default\/files\/styles\/article_floated\/public\/Figure7container_images_option.png?itok=dHUNZc5t\" alt=\"Use this option to run an existing container image in OpenShift.\"\/><\/a><figcaption class=\"wp-element-caption\">Figure 11: Use this option to run an existing container image in OpenShift.<\/figcaption><\/figure>\n\n\n\n<p>This is the option I use 100% of the time. I like to build and test my images on my PC, then push them to my image registry (quay.io\/donschenck). Once I host an image in a registry, it&#8217;s very simple to get it into OpenShift.<\/p>\n\n\n\n<p>Just like the other two options, the simplest path is to provide the location of the input\u2014an image in this case (Figure 12), and click&nbsp;<strong>Create<\/strong>. Yes, it really is that simple.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/developers.redhat.com\/sites\/default\/files\/Figure8openshift-deploy-image.png\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" src=\"https:\/\/developers.redhat.com\/sites\/default\/files\/styles\/article_floated\/public\/Figure8openshift-deploy-image.png?itok=Xm12XIm2\" alt=\"Provide the location of the input and click Create.\"\/><\/a><figcaption class=\"wp-element-caption\">Figure 12: Provide the location of the input and click Create.<\/figcaption><\/figure>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this lesson, you will: Build the application from a container image To build your application from a container image, switch to the&nbsp;Developer&nbsp;view in your OpenShift dashboard (Figure 8): Next,&#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[5153],"tags":[],"class_list":["post-50034","post","type-post","status-publish","format-standard","hentry","category-openshift"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/50034","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=50034"}],"version-history":[{"count":3,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/50034\/revisions"}],"predecessor-version":[{"id":50071,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/50034\/revisions\/50071"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=50034"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=50034"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=50034"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}