OpenShift v3 is a layered system designed to expose underlying Docker-formatted container image and Kubernetes concepts as accurately as possible, with a focus on easy composition of applications by a developer. For example, install Ruby, push code, and add MySQL.
These instances have been preconfigured with
docker and the
oc command. The
oc command makes deploying OpenShift for development purposes incredibly
oc cluster up command starts a OpenShift all-in-one cluster with a
configured registry, router, image streams, and default templates.
Next use the following command to bring up the cluster on your local machine.
<div class="alert alert-warning">
<span class="pficon pficon-warning-triangle-o"></span>
But first! export your student number to sync up with the wildcard DNS mapped
to your instance. For example below, if you are student
oc cluster up --public-hostname=$(curl -s http://169.254.169.254/latest/meta-data/public-ipv4) --routing-suffix=apps.ocp.$STUDENT.redhatgov.io --host-pv-dir=/data --host-data-dir=/data
Using nsenter mounter for OpenShift volumes Using public hostname IP 184.108.40.206 as the host IP Using 220.127.116.11 as the server IP Starting OpenShift using openshift/origin:v3.9.0 ... OpenShift server started. The server is accessible via web console at: https://18.104.22.168:8443 (1) You are logged in as: User: developer Password: <any value> To login as administrator: oc login -u system:admin
Launch your first application.
You should be logged in as
Create a new Project for your first app.
oc new-project flask --description="Python Flask App" --display-name="Flask App"
Now use the
new-app command to create the new app from a simple Python flask
repository on GitHub. By using the
--strategy=source we can pass it the type
of container to build and launch the app. In this case we are using
oc new-app --strategy=source python:3.5~https://github.com/RedHatGov/OCP-App.git --name=flask-app
Now follow the logs as its being built.
oc logs -f bc/flask-app
Open a browser next to the terminal so you can see the app get created
Login to OpenShift
Username: developer Password: developer
Click on the new project you created
Now we need to create a
to see the app.
Create Route in the top right corner. Accept the defaults and click
Now lets see your first app. Click the new route. It should look similar to
Congratulations! You have launched your first app in OpenShift!
You just launched OpenShift on AWS
You launched a containerized python app
oc cluster up \ --public-hostname=$(curl -s http://169.254.169.254/latest/meta-data/public-ipv4) \ (1) --routing-suffix=apps.ocp.$STUDENT.redhatgov.io \ (2) --host-pv-dir=/data \ (3) --host-data-dir=/data (4)
|1||This sets OpenShift’s public name to the public ip of the AMI, via the AWS metadata service (169.254.169.254).|
|2||This sets the wildcard domain for all of the applications you provision in OpenShift.|
|3||Cluster up creates a set of persistent volumes by default. It exposes a new flag that allows setting the directory on the host for these volumes.|
|4||To persist data across restarts, specify a valid host directory when
starting your cluster with