Openshift 如何在minishift中运行基本centos映像?

Openshift 如何在minishift中运行基本centos映像?,openshift,minishift,Openshift,Minishift,我试图学习OpenShift,它是如何工作的,如何运行应用程序,构建图像等 首先,我认为这将非常简单,我决定使用基于图像的纯centos7操作系统运行一个pod。我在本地安装了minishift v1.11.0+4459917,创建了一个新项目,并执行了以下命令: 本项目中的oc新应用程序openshift/base-centos7。因此,我收到了以下消息: --> Found Docker image bb81a09 (11 months old) from Docker Hub for

我试图学习OpenShift,它是如何工作的,如何运行应用程序,构建图像等

首先,我认为这将非常简单,我决定使用基于图像的纯centos7操作系统运行一个pod。我在本地安装了minishift v1.11.0+4459917,创建了一个新项目,并执行了以下命令: 本项目中的oc新应用程序openshift/base-centos7。因此,我收到了以下消息:

--> Found Docker image bb81a09 (11 months old) from Docker Hub for "openshift/base-centos7"

    * An image stream will be created as "pon3:latest" that will track this image
    * This image will be deployed in deployment config "pon3"
    * The image does not expose any ports - if you want to load balance or send traffic to this component
      you will need to create a service with 'expose dc/pon3 --port=[port]' later
    * WARNING: Image "openshift/base-centos7" runs as the 'root' user which may not be permitted by your cluster administrator

--> Creating resources ...
    imagestream "pon3" created
    deploymentconfig "pon3" created
--> Success
    Run 'oc status' to view your app.
正如我在警告中所看到的,这个图像以root运行,这显然不是一个好的实践,但它可能会被解决,正如所描述和描述的。我尝试了这两种方法-我用anyuid-scc创建了一个新的服务帐户,并将anyuid-scc分配给默认sa。不幸的是,我仍然无法运行基于此图像的吊舱。结果如下所示:

oc get pods

mycentos-1-deploy         1/1       Running            0          32s
mycentos-1-p1vh5          0/1       CrashLoopBackOff   1          30s
我尝试以这种方式进行故障排除:

oc logs -p mycentos-1-p1vh5

This image serves as the base image for all OpenShift v3 S2I builder images.
It provides all essential libraries and development tools needed to
successfully build and run an application.

To use this image as a base image, you need to have 's2i/bin' directory in the
same directory as your S2I image Dockerfile. This directory should contain S2I
scripts.

This base image also provides the default user you should use to run your
application. Your Dockerfile should include this instruction after you finish
installing software:

USER default

The default directory for installing your application sources is
'/opt/app-root/src' and the WORKDIR and HOME for the 'default' user is set
to this directory as well. In your S2I scripts, you don't have to use absolute
path, but rather rely on the relative path.

To learn more about S2I visit: https://github.com/openshift/source-to-image
此外,我还尝试使用oc adm diagnostics进行故障排除,但老实说,我没有看到与此问题相关的任何内容

我显然遗漏了一些东西。有人能给我一个提示如何处理这个问题,或者我如何尝试解决这个问题?运行纯centos有不同的方式吗


感谢您的帮助。

您需要使用oc new app部署的映像才能在其中包含实际应用程序。openshift/base-centos7映像只是一个基础映像,其他映像都是基于它构建的,并且没有应用程序

如果您只想启动一个容器并获得一个shell环境,您可以在其中使用oc run命令

OpenShift不像传统的VPS,在VPS中,您只需启动永久性的shell环境,然后访问这些环境来手动设置应用程序。其思想是将应用程序构建到映像中并部署应用程序

我建议你去读:

并在以下位置完成练习:


要了解更多关于什么是OpenShift以及如何使用它的信息。

嗨,格雷厄姆,非常感谢您提供的所有信息和来源-我一定会看一下。我尝试运行以下命令:oc run centos7-image=openshift/base-centos7,但不幸的是,它也失败了。结果如下:centos7-1-67ttw 0/1 CrashLoopBackOff 3 2m centos7-1-deploy 1/1运行0 2m另外,当我运行oc Descripte pod centos7-1-67ttw查看一些日志时,我可以看到一个事件错误同步pod。你知道我做错了什么吗?感谢您的帮助。请正确研究该命令。您需要提供选项,让它为您提供交互式shell。请参阅-tty、-stdin和-restart=Never选项。查看这些,然后提供您正在运行并可以调试的完整命令。