Java OpenShift模板,带有部署my war的jboss/wildfly docker映像(二进制源代码策略)

Java OpenShift模板,带有部署my war的jboss/wildfly docker映像(二进制源代码策略),java,docker,openshift,wildfly,Java,Docker,Openshift,Wildfly,在我的OpenShift模板中,我有以下BuildConfig: - kind: BuildConfig apiVersion: v1 metadata: name: "webapp-build" spec: triggers: - type: ImageChange source: type: Binary strategy: sourceStrategy:

在我的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上发现了这个错误:

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)生成开始之前执行的检查中引发错误

如果我正确理解您的需求,您可能正在寻找适合您的构建的
jboss/wildfly
映像是不用于s2i的运行时映像(即,没有s2i脚本)。因此,请改用此
sourceStrategy

    sourceStrategy:
      from:
        kind: DockerImage
        # Uses WildFly 11.0
        name: "openshift/wildfly-110-centos7:latest"
或者,如果您真的想使用该特定图像,您可以通过执行以下操作来实现

  • 创建一个用户配置正确的新映像,并从构建配置中的
    ImageStreamTag
    而不是
    DockerImage
    使用此映像
    oc new build-D$'来自docker.io/jboss/wildfly:11.0.0.Final\user 1001'-to=wildfly:latest
  • sourceStrategy
    配置中。这里的期望是这些脚本知道如何处理二进制工件

  • “openshift/wildfly-110-centos7:最新版本”非常有魅力,谢谢!