Search code examples
dockerquarkusquarkus-native

Quarkus getting started `GLIBC_2.33' not found when trying to run Dockerfile.native_micro


Trying out quarks went through creating your first app get-started, saw it produced the 4 different Dockerfiles for you. The native being one of the features of quarkus I wanted to try those so followed the instructions in each of the files. All the steps worked until I went to run the Dockerfile.native/.native-micro then failed with the following error.

./mvnw package -Dnative
podman build -f src/main/docker/Dockerfile.native-micro -t quarkus/order-processor-dapr .
podman run -i --rm -p 8080:8080 quarkus/order-processor-dapr
...
./application: /lib64/libc.so.6: version `GLIBC_2.33' not found (required by ./application)
./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)

considering this is straight out of the box tutorial, I'm wondering what I'm missing or if something isn't right with the setup. I can't imagine Podman being the problem for that particular error.

Dockerfile native

FROM registry.access.redhat.com/ubi8/ubi-minimal:8.9
WORKDIR /work/
RUN chown 1001 /work \
    && chmod "g+rwX" /work \
    && chown 1001:root /work
COPY --chown=1001:root target/*-runner /work/application

EXPOSE 8080
USER 1001

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

Solution

  • During native compilation, the native-image will link against dynamic libraries. The library versions on our local machine might be different from the versions used in, for example, the micro image. Therefore, it is best practice to run the naitve-image compilation in a container when we want to run it in a container later on.

    We can explicitly instruct quarkus to build the native image in a container by setting -Dquarkus.native.container-build=true:

    ./mvnw \
      -Dnative \
      -Dquarkus.native.container-build=true \
       clean package
    

    For more information, I recommend reading the guide on native compilation at quarkus.io. For advanced topics on native compilation, please see section "Related content" on the bottom of the page. It links to related articles.