Home > Enterprise >  GLIBC incompatibility on debian docker
GLIBC incompatibility on debian docker

Time:07-20

I'm trying to build a rust app with rust-rocksdb as a dependency.

Using the latest rust docker image to compile and then moving the binary to a debian. This is how my Dockerfile looks

FROM rust:1.61 as builder

RUN USER=root cargo new --bin fbrust
WORKDIR ./fbrust
COPY ./Cargo.toml ./Cargo.toml
COPY ./Cargo.lock ./Cargo.lock

RUN apt-get update \
    && apt-get install -y ca-certificates tzdata libclang-dev \
    && rm -rf /var/lib/apt/lists/*

RUN cargo build --release
RUN rm src/*.rs

ADD . ./

RUN rm ./target/release/deps/fbrust*
RUN cargo build --release


FROM debian:buster-slim
ARG APP=/usr/src/app

EXPOSE 5005

ENV TZ=Etc/UTC \
APP_USER=appuser

RUN groupadd $APP_USER \
    && useradd -g $APP_USER $APP_USER \
    && mkdir -p ${APP}

COPY --from=builder /fbrust/target/release/fbrust ${APP}/fbrust

RUN chown -R $APP_USER:$APP_USER ${APP}

USER $APP_USER
WORKDIR ${APP}

CMD ["./fbrust"]

I'm now getting this error(s):

./fbrust: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by ./fbrust)
./fbrust: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.30' not found (required by ./fbrust)
./fbrust: /usr/lib/x86_64-linux-gnu/libstdc  .so.6: version `GLIBCXX_3.4.26' not found (required by ./fbrust)

First of all, I'm confused why do I see both 2.29 and 2.30 required.

I checked within the container and indeed I have 2.28

||/ Name           Version      Architecture Description
   -==============-============-============-=================================
ii  libc-bin       2.28-10      amd64        GNU C Library: Binaries

Is there any other image I can use to achieve compatibility or can I get a hint on what dependencies/setup should I try?

CodePudding user response:

If you look at the list of Debian releases, as of this writing Debian 10 "Buster" is one release behind, and Debian 11 "Bullseye" is the current released stable version. You can also look at the libc6 package listing and see that "Buster" contains libc6 2.28, and "Bullseye" contains libc6 2.31 (both with local patches).

So for your setup, it should work to change the final image to a newer version of Debian, like

FROM debian:bullseye-stable # one newer than buster
  • Related