OpenShift Create an Application from a Docker Image: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 18: Line 18:
The utility creates an image stream, a deployment configuration and a service in the ''current project'', and associate all of them with a single application by annotating them with the "app=<''application-name''>" label, where the application name is inferred from - and equal to - the name of the image repository given as argument.
The utility creates an image stream, a deployment configuration and a service in the ''current project'', and associate all of them with a single application by annotating them with the "app=<''application-name''>" label, where the application name is inferred from - and equal to - the name of the image repository given as argument.


1. '''Image Stream'''. The [[OpenShift_Concepts#Image_Stream|image stream]] name is set to the application name.
1. '''Image Stream'''. The [[OpenShift_Concepts#Image_Stream|image stream]] name is set to the application name, and the object is associated with the application by the "app=<''app-name''> label.


  apiVersion: v1
  apiVersion: v1
Line 39: Line 39:
{{Internal|OpenShift_Concepts#Image_Stream|Image Streams}}
{{Internal|OpenShift_Concepts#Image_Stream|Image Streams}}


2. '''Deployment Configuration''' The [[OpenShift Concepts#Deployment_Configuration|deployment configuration]] name is set to the application name.
2. '''Deployment Configuration''' The [[OpenShift Concepts#Deployment_Configuration|deployment configuration]] name is set to the application name and the object is associated with the application by the "app=<''app-name''> label.
 


3. '''Service'''
3. '''Service'''

Revision as of 02:20, 20 January 2018

Internal

Overview

A Docker image repository URL can be provided to oc new-app to create an application based on that image.

oc new-app <docker-repository-URL>

Example:

oc new-app docker.io/sonatype/nexus3:latest

Primitives

The utility creates an image stream, a deployment configuration and a service in the current project, and associate all of them with a single application by annotating them with the "app=<application-name>" label, where the application name is inferred from - and equal to - the name of the image repository given as argument.

1. Image Stream. The image stream name is set to the application name, and the object is associated with the application by the "app=<app-name> label.

apiVersion: v1
kind: ImageStream
metadata:
 labels:
   app: nexus3
 name: nexus3
spec:
 lookupPolicy:
   local: false
 tags:
   name: latest
   from:
     kind: DockerImage
     name: docker.io/sonatype/nexus3:latest
   referencePolicy:
     type: Source
Image Streams

2. Deployment Configuration The deployment configuration name is set to the application name and the object is associated with the application by the "app=<app-name> label.


3. Service

For more details on how to deploy a production-ready Nexus instance starting with oc new-app <nexus-image-url>, go to:

Deploy Nexus Based on a Standard Sonatype Docker Image