Geoffrey De Smet
Geoffrey De Smet

Reputation: 27357

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

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

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?

Upvotes: 1

Views: 1932

Answers (1)

abn
abn

Reputation: 414

Looks like you are using a non s2i image for a sourceStrategy build. 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.

If I am understanding your need correct, you might be looking for the s2i-wildfly image for your build. The jboss/wildfly images are runtime images not intended for s2i use (ie. there are no s2i scripts). So use this sourceStrategy instead:

    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. 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. The expectation here is that these scripts know what to do with your binary artifact.

Upvotes: 2

Related Questions