繁体   English   中英

带有部署我的战争的jboss / wildfly docker映像的OpenShift模板(二进制源策略)

[英]OpenShift template with the jboss/wildfly docker image that deploys my war (binary source strategy)

在我的OpenShift模板中,我具有以下BuildConfig:

  - kind: BuildConfig
    apiVersion: v1
    metadata:
      name: "webapp-build"
    spec:
      triggers:
        - type: ImageChange
      source:
        type: Binary
      strategy:
        sourceStrategy:
          from:
            kind: DockerImage
            name: jboss/wildfly:11.0.0.Final
      output:
        to:
          kind: ImageStreamTag
          name: "webapp-image:latest"
      resources:
        limits:
          cpu: 1
          memory: 1Gi

我打电话给:

oc start-build "webapp-build" --from-file=target/ROOT.war

但是我在OpenShift Dedicated上收到此错误:

Pulling image "jboss/wildfly:11.0.0.Final" ...
error: build error: image "jboss/wildfly:11.0.0.Final" must specify a user that is numeric and within the range of allowed users

这是为什么?

看起来您正在使用非s2i映像进行sourceStrategy构建。 出现错误的原因是因为该图像指定了非数字用户。

$ docker inspect docker.io/jboss/wildfly:11.0.0.Final | jq '.[] | .Config.User'
"jboss"

这会在开始s2i(sourceStrategy)构建之前执行的IsUserAllowed检查中引发错误。

如果我理解您的需求正确, 那么您可能正在为您的build寻找s2i-wildfly映像 jboss/wildfly映像是不用于s2i的运行时映像(即,没有s2i脚本)。 因此,请改用以下sourceStrategy

    sourceStrategy:
      from:
        kind: DockerImage
        # Uses WildFly 11.0
        name: "openshift/wildfly-110-centos7:latest"

另外,如果您确实要使用该特定图像,则可以执行以下操作。

  1. 使用正确的用户配置创建一个新映像,并在构建配置中使用ImageStreamTag而不是DockerImage进行使用。 oc new-build -D $'FROM docker.io/jboss/wildfly:11.0.0.Final\\nUSER 1001' --to=wildfly:latest
  2. sourceStrategy配置中指定脚本url参数 这里的期望是这些脚本知道如何处理二进制工件。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM