quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.68k stars 2.65k forks source link

build in docker result in GLIBC_2.32 #35939

Closed nort3x closed 1 year ago

nort3x commented 1 year ago

Describe the bug

I want to build Quarkus native executable in Dockerfile instead of some configured environment, already tried -Dquarkus.native.container-build=true but it exits with docker-daemon not found (yes there is no docker in this build environment) Here is my Dockerfile which builds executable in first stage and copy-and-serve it successfully produce an image:

FROM findepi/graalvm:java20-all as build

ENV APP_HOME=/app/
WORKDIR $APP_HOME

COPY build.gradle.kts settings.gradle.kts gradlew $APP_HOME
COPY gradle $APP_HOME/gradle
RUN chmod +x gradlew
RUN ./gradlew build || return 0
COPY . .
RUN chmod +x gradlew
RUN ./gradlew build -Dquarkus.package.type=native -x test

FROM registry.access.redhat.com/ubi8/ubi-minimal:8.8 as run

ENV APP_HOME=/app/
WORKDIR $APP_HOME

RUN chown 1001 $APP_HOME \
    && chmod "g+rwX" $APP_HOME \
    && chown 1001:root $APP_HOME

COPY --from=build --chown=1001:root $APP_HOME/build/*-runner $APP_HOME/application

EXPOSE 8080
USER 1001

CMD ["./application", "-Dquarkus.http.host=0.0.0.0"]

when i run produced image i get:

./application: /lib64/libc.so.6: version `GLIBC_2.32' not found (required by ./application)
./application: /lib64/libc.so.6: version `GLIBC_2.34' not found (required by ./application)

what am i missing here?

Expected behavior

No response

Actual behavior

No response

How to Reproduce?

No response

Output of uname -a or ver

No response

Output of java -version

No response

GraalVM version (if different from Java)

No response

Quarkus version or git rev

No response

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

No response

manofthepeace commented 1 year ago

You build with an image that has a base image of debian:stable which has a certain version of glibc, you then try to run on a ubi8 image that has another/incompatible version of glibc.

I suggest you use https://quay.io/repository/quarkus/ubi-quarkus-mandrel-builder-image?tab=tags or https://quay.io/repository/quarkus/ubi-quarkus-graalvmce-builder-image?tab=tags

and run with the following; quay.io/quarkus/quarkus-micro-image:2.0

source: https://quarkus.io/guides/building-native-image