Search code examples
dockeropenshiftgraalvmquarkusokd

container_linux.go:247: invalid header field value - permission > denied - Problem with Quarkus native image on OpenShift


I'm trying to run a Quarkus native image application on Openshift 3.x.

I've generated the native image in a Fedora machine following Quarkus' instructions:

./mvnw package -Pnative

I've verified that the generated binary runs ok in the Fedora machine:

2019-05-30 08:45:06,957 INFO  [io.quarkus] (main) Quarkus 0.15.0 started in 0.052s. Listening on: http://0.0.0.0:8080
2019-05-30 08:45:06,963 INFO  [io.quarkus] (main) Installed features: [cdi, resteasy, resteasy-jsonb]
^C2019-05-30 08:45:12,836 INFO  [io.quarkus] (main) Quarkus stopped in 0.011s

Then I insert that image into a Docker container:

FROM registry.fedoraproject.org/fedora-minimal
WORKDIR /work/

RUN curl -v -H 'Cache-Control: no-cache' -fSL "http://xxx/quarkus-ms-users-1.0-SNAPSHOT-runner" -o /work/application

RUN ls -la /work
EXPOSE 8080
CMD ["./application", "-Dquarkus.http.host=0.0.0.0"]

I build the image in Openshift and when the container is deployed it fails with:

Error: failed to start container "quarkus-native-ms-users": Error response from daemon: {"message":"invalid header field value \"oci runtime error: container_linux.go:247: starting container process caused \\"exec: \\\\"./application\\\\": permission denied\\"\n\""}

What's wrong with this image?


Solution

  • The problem was I was missing the execution permision for the binary RUN chmod +x /work/application.

    Complete Dockerfile:

    FROM registry.fedoraproject.org/fedora-minimal
    WORKDIR /work/
    
    RUN curl -v -H 'Cache-Control: no-cache' -fSL "http://xxx/quarkus-ms-users-1.0-SNAPSHOT-runner" -o /work/application
    RUN chmod +x /work/application
    RUN ls -la /work
    EXPOSE 8080
    CMD ["./application", "-Dquarkus.http.host=0.0.0.0"]