简体   繁体   English

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

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

In my OpenShift template, I have this BuildConfig: 在我的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

Which I call with: 我打电话给:

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

But I get this error on OpenShift Dedicated: 但是我在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

Why is that? 这是为什么?

Looks like you are using a non s2i image for a sourceStrategy build. 看起来您正在使用非s2i映像进行sourceStrategy构建。 The reason you are getting the error is because the image specifies a non-numeric user. 出现错误的原因是因为该图像指定了非数字用户。

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

This raises an error in the IsUserAllowed check performed prior to an s2i (sourceStrategy) build starts. 这会在开始s2i(sourceStrategy)构建之前执行的IsUserAllowed检查中引发错误。

If I am understanding your need correct, you might be looking for the s2i-wildfly image for your build . 如果我理解您的需求正确, 那么您可能正在为您的build寻找s2i-wildfly映像 The jboss/wildfly images are runtime images not intended for s2i use (ie. there are no s2i scripts). jboss/wildfly映像是不用于s2i的运行时映像(即,没有s2i脚本)。 So use this sourceStrategy instead: 因此,请改用以下sourceStrategy

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

Alternatively, if you really want to use that particular image, you can do so by doing the following. 另外,如果您确实要使用该特定图像,则可以执行以下操作。

  1. Create a new image with user configured correct and use this from the ImageStreamTag instead of the DockerImage in your build config. 使用正确的用户配置创建一个新映像,并在构建配置中使用ImageStreamTag而不是DockerImage进行使用。 oc new-build -D $'FROM docker.io/jboss/wildfly:11.0.0.Final\\nUSER 1001' --to=wildfly:latest . oc new-build -D $'FROM docker.io/jboss/wildfly:11.0.0.Final\\nUSER 1001' --to=wildfly:latest
  2. Specify scripts url parameter in your sourceStrategy configuration. sourceStrategy配置中指定脚本url参数 The expectation here is that these scripts know what to do with your binary artifact. 这里的期望是这些脚本知道如何处理二进制工件。

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

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