Good, simple 2-stage Docker setup

Dockerfile I'm working with:

FROM rust:1.80.1 AS builder
COPY . .
RUN cargo build --release

FROM debian:bullseye-slim AS runner
COPY --from=builder /target/ ./target/
RUN apt-get update && apt install -y openssl
CMD ["/target/release/server"]

Errors upon running:

/target/release/server: /lib/aarch64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by /target/release/server)
/target/release/server: /lib/aarch64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /target/release/server)
/target/release/server: /lib/aarch64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /target/release/server)

I know this is due to the build image having a newer version of libc than debian:bullseye-slim. Rather than hunting down base images, versions, etc., can someone offer suggestions on a good runtime image presently?

(I want something less than a full distro, but it doesn't have to be tiny.)

(I do need Rust 1.80 also.)

You could go the Alpine way, but there are many gotchas that I don't think are worth the effort. Just use debian:bookworm-slim and call it a day.

2 Likes

Just what I needed.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.