Difficulty: beginner
Estimated Time: 15-20 minutes


Learn how to deploy an application from its source code using a Source-to-Image build on OpenShift.


  • Linux containers and building container images
  • OpenShift Source-to-Image (S2I)
  • OpenShift Projects and Applications
  • OpenShift oc command line tool

Use case

You can have OpenShift build an application from source to deploy it, so you don't have to construct a container by hand with every change. OpenShift can then build and deploy new versions automatically when notified of souce code changes.

This OpenShift cluster will self-destruct in one hour.

In this course you learned about deploying an application from source code using a Source-to-Image (S2I) builder. You first deployed the application from the web console, following that up with using the command line. You also learnt about using binary input source builds to run builds using source code from a local directory on your own computer.

The web application you deployed was implemented using the Python programming language. OpenShift provides S2I builders for a number of different programming languages/frameworks in addition to Python. These include Java, NodeJS, Perl, PHP and Ruby.

Continue Learning

You can continue learning more about OpenShift and how to develop applications on the platform by completing other tutorials at https://learn.openshift.com.

For developer-related resources about OpenShift, visit https://developers.redhat.com/products/openshift/getting-started.

Run OpenShift Locally with CodeReady Containers

CodeReady Containers allows you to run a minimal, pre-configured OpenShift 4 cluster on your local machine. The project supports Windows 10, macOS, and Linux. To find out more or download CodeReady Containers, visit https://developers.redhat.com/products/codeready-containers/overview

Compare Hosted, Managed, or On Premises OpenShift

Learn more about the different OpenShift platform variants here: https://www.openshift.com/try

Browse the Documentation

If you want to learn about particular OpenShift concepts in more depth, visit the documentation: https://docs.openshift.com/container-platform/latest

Deploying Applications From Source

Step 1 of 7

Topic 1 - Creating an Initial Project

Before we get started, you need to login and create a project in OpenShift to work in.

To login to the OpenShift cluster used for this course from the Terminal, run:

oc login -u developer -p developer

This will log you in using the credentials:

  • Username: developer
  • Password: developer

You should see the output:

Login successful.

You don't have any projects. You can try to create a new project, by running

    oc new-project <projectname>

To create a new project called myproject run the command:

oc new-project myproject

You should see output similar to:

Now using project "myproject" on server "https://openshift:6443".

You can add applications to this project with the 'new-app' command. For example, try:

    oc new-app django-psql-example

to build a new example application in Python. Or use kubectl to deploy a simple Kubernetes application:

    kubectl create deployment hello-node --image=gcr.io/hello-minikube-zero-install/hello-node

Switch to the Console and login to the OpenShift web console using the same credentials you used above.

Web Console Login

This should leave you at the list of projects you have access to. As we only created the one project, all you should see is myproject.

List of Projects

Click on myproject and you should then be at the Overview page for the project. Select the Developer perspective for the project instead of the Adminstrator perspective in the left hand side menu. If necessary click on the hamburger menu icon top left of the web console to expose the left hand side menu.

Add to Project

As the project is currently empty, no workloads should be found and you will be presented with various options for how you can deploy an application.