Difficulty: beginner
Estimated Time: 10-15 minutes

When using OpenShift there are a number of different ways you can add an application. The main methods are:

  • Deploy an application from an existing Docker-formatted image.
  • Build and deploy from source code contained in a Git repository using a Source-to-Image builder.
  • Build and deploy from source code contained in a Git repository from a Dockerfile.

In this course you will learn how to deploy an application from an existing Docker-formatted image using the OpenShift web console, and from the command line using oc.

In this course you learnt about deploying an existing Docker-formatted container image to OpenShift. You first deployed an image direct from an external image registry. This was followed by importing an image into the OpenShift internal registry, and then deploying the image from the internal registry.

You can find a summary of the key commands covered below. To see more information on each oc command, run it with the --help option.

oc new-app <docker-image> --name <name>: Deploy an application from a Docker-formatted image found on an external image registry. If there is any ambiguity as to the source of the image, use the --docker-image option.

oc new-app <image-stream> --name <name>: Deploy an application from a Docker-formatted image found in the internal image registry. If there is any ambiguity as to the source of the image, use the --image-stream option.

oc import-image <docker-image> --confirm: Import a Docker-formatted image found on an external image registry, causing it to be pulled into the internal image registry.

Don’t stop now! The next scenario will only take about 10 minutes to complete.

Deploying Applications From Images

Step 1 of 6

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://172.17.0.41:8443".

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

    oc new-app centos/ruby-22-centos7~https://github.com/openshift/ruby-ex.git

to build a new example application in Ruby.

Switch to the Dashboard 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 be left at the Overview page for the project.

Project Overview

As the project is currently empty, you should be presented with an Add to Project button.