It’s easy to get started with OpenShift whether you’re using our app templates or bringing your existing assets. In this quick lab we will deploy an application using an exisiting container image. OpenShift will create an image stream for the image as well as deploy and manage containers based on that image.
Choose either to complete the steps via CLI or Web Console.
Note: You can only choose one OR the other not both.
Goto the terminal and type the following to create a new project:
$ oc new-project demo-YOUR# Now using project "demo-YOUR#" on server "https://172.30.0.1:443". You can add applications to this project with the 'new-app' command. For example, try: oc new-app rails-postgresql-example to build a new example application in Ruby. Or use kubectl to deploy a simple Kubernetes application: kubectl create deployment hello-node --image=k8s.gcr.io/serve_hostname
$ oc project demo-YOUR#
$ oc new-app sonatype/nexus:oss --as-deployment-config=true
--> Found container image 8027e6d (2 months old) from Docker Hub for "sonatype/nexus:oss" Red Hat Universal Base Image 7 ------------------------------ The Universal Base Image is designed and engineered to be the base layer for all of your conta inerized applications, middleware and utilities. This base image is freely redistributable, but Re d Hat only supports Red Hat technologies through subscriptions for Red Hat products. This image is maintained by Red Hat and updated regularly. Tags: base rhel7 * An image stream tag will be created as "nexus:oss" that will track this image * This image will be deployed in deployment config "nexus" * Port 8081/tcp will be load balanced by service "nexus" * Other containers can access this service through the hostname "nexus" * This image declares volumes and will default to use non-persistent, host-local storage. You can add persistent volumes later by running 'oc set volume dc/nexus --add ...' --> Creating resources ... imagestream.image.openshift.io "nexus" created deploymentconfig.apps.openshift.io "nexus" created service "nexus" created --> Success Application is not exposed. You can expose services to the outside world by executing one or m ore of the commands below: 'oc expose svc/nexus' Run 'oc status' to view your app.
$ oc expose service/nexus --path=/nexus
Ensure that you are in “Developer” mode, by clicking on the menu, in the top left corner under the logo and selecting “Developer”
Create a new project by selecting the “Project:” drop down and selecting “Create project"
Note: When prompted, ensure to create the project with the name demo-YOUR#
Click “+Add” and then “Container Image”, to add an existing image from the container registry
Select the option for “Image name from external registry” and enter “sonatype/nexus:oss”, then ensure that the image is validated.
Enter the values shown, in the image above.
|Create a route to the Application||Checked|
|Click "Show advanced Routing options"|