Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

version `GLIBC_2.29' not found

Tags:

docker

rust

I am basing my dockerfile on the rust base image. When deploying my image to an azure container, I receive this log: ./bot: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by ./bot)

./bot is my application. The error also occurs when I perform docker run on my Linux Mint desktop.

How can I get GLIBC into my container?

Dockerfile

FROM rust:1.50
WORKDIR /usr/vectorizer/

COPY ./Cargo.toml /usr/vectorizer/Cargo.toml
COPY ./target/release/trampoline /usr/vectorizer/trampoline
COPY ./target/release/bot /usr/vectorizer/bot
COPY ./target/release/template.svg /usr/vectorizer/template.svg

RUN apt-get update && \
    apt-get dist-upgrade -y && \
    apt-get install -y musl-tools && \
    rustup target add x86_64-unknown-linux-musl

CMD ["./trampoline"]
like image 917
dcdgo Avatar asked Aug 06 '26 01:08

dcdgo


1 Answers

Now I don't totally understand the dependencies of your particular project but the below Dockerfile should get you started.

What you want to do is compile in an image that has all of your dev dependencies and then move the build artifacts to a much smaller (but compatible) image.

FROM rust:1.50 as builder

RUN USER=root

RUN mkdir bot
WORKDIR /bot
ADD . ./
RUN cargo clean && \
    cargo build -vv --release

FROM debian:buster-slim

ARG APP=/usr/src/app

ENV APP_USER=appuser

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

# Copy the compiled binaries into the new container.
COPY --from=builder /bot/target/release/bot ${APP}/bot

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

USER $APP_USER
WORKDIR ${APP}

CMD ["./trampoline"]
like image 68
WBuck Avatar answered Aug 07 '26 17:08

WBuck