This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.2.9. 示例应用程序
odo
提供与 OpenShift 组件类型目录中列出的语言或运行时的部分兼容性。例如:
对于 odo
,Java 和 Node.js 是官方支持的组件类型。运行 odo catalog list components
来验证官方支持的组件类型。
要通过 web 访问该组件,请使用 odo url create
创建一个 URL。
2.9.1. Git 软件仓库示例 复制链接链接已复制到粘贴板!
2.9.1.1. httpd 复制链接链接已复制到粘贴板!
这个示例在 CentOS 7 上使用 httpd 构建并提供静态内容。有关使用这个构建器镜像的更多信息,包括 OpenShift Container Platform 的注意事项,请查看 Apache HTTP 服务器容器镜像存储库。
odo create httpd --git https://github.com/openshift/httpd-ex.git
$ odo create httpd --git https://github.com/openshift/httpd-ex.git
2.9.1.2. java 复制链接链接已复制到粘贴板!
这个示例在 CentOS 7 上构建并运行 fat JAR Java 应用程序。有关使用这个构建器镜像的更多信息,包括 OpenShift Container Platform 的注意事项,请参见 Java S2I Builder image。
odo create java --git https://github.com/spring-projects/spring-petclinic.git
$ odo create java --git https://github.com/spring-projects/spring-petclinic.git
2.9.1.3. nodejs 复制链接链接已复制到粘贴板!
在 CentOS 7 中构建并运行 Node.js 应用程序。有关使用这个构建器镜像的更多信息,包括 OpenShift Container Platform 的注意事项,请参见 Node.js 8 container image。
odo create nodejs --git https://github.com/openshift/nodejs-ex.git
$ odo create nodejs --git https://github.com/openshift/nodejs-ex.git
2.9.1.4. Perl 复制链接链接已复制到粘贴板!
这个示例在 CentOS 7 中构建并运行 Perl 应用程序。有关使用这个构建器镜像的更多信息,包括 OpenShift Container Platform 的注意事项,请查看 Perl 5.26 容器镜像。
odo create perl --git https://github.com/openshift/dancer-ex.git
$ odo create perl --git https://github.com/openshift/dancer-ex.git
2.9.1.5. php 复制链接链接已复制到粘贴板!
这个示例在 CentOS 7 中构建并运行 PHP 应用程序。有关使用这个构建器镜像的更多信息,包括 OpenShift Container Platform 的注意事项,请参见 PHP 7.1 Docker image。
odo create php --git https://github.com/openshift/cakephp-ex.git
$ odo create php --git https://github.com/openshift/cakephp-ex.git
2.9.1.6. Python 复制链接链接已复制到粘贴板!
这个示例在 CentOS 7 中构建并运行 Python 应用程序。有关使用这个构建器镜像的更多信息,包括 OpenShift Container Platform 的注意事项,请查看 Python 3.6 容器镜像。
odo create python --git https://github.com/openshift/django-ex.git
$ odo create python --git https://github.com/openshift/django-ex.git
2.9.1.7. Ruby 复制链接链接已复制到粘贴板!
这个示例在 CentOS 7 中构建并运行 Ruby 应用程序。有关使用这个构建器镜像的更多信息,包括 OpenShift Container Platform 的注意事项,请参见 Ruby 2.5 container image。
odo create ruby --git https://github.com/openshift/ruby-ex.git
$ odo create ruby --git https://github.com/openshift/ruby-ex.git
2.9.1.8. WildFly 复制链接链接已复制到粘贴板!
这个示例在 CentOS 7 中构建并运行 WildFly 应用程序。有关使用这个构建器镜像的更多信息,包括 OpenShift Container Platform 的注意事项,请 查看 Wilfly - OpenShift 的 CentOS Docker 镜像。
odo create wildfly --git https://github.com/openshift/openshift-jee-sample.git
$ odo create wildfly --git https://github.com/openshift/openshift-jee-sample.git
2.9.2. 二进制示例 复制链接链接已复制到粘贴板!
2.9.2.1. java 复制链接链接已复制到粘贴板!
Java 可以用来部署二进制工件,如下:
git clone https://github.com/spring-projects/spring-petclinic.git cd spring-petclinic mvn package odo create java test3 --binary target/*.jar odo push
$ git clone https://github.com/spring-projects/spring-petclinic.git
$ cd spring-petclinic
$ mvn package
$ odo create java test3 --binary target/*.jar
$ odo push
2.9.2.2. WildFly 复制链接链接已复制到粘贴板!
WildFly 可以用来部署二进制应用程序,如下: