#Rust 1.72 Docker: error while loading shared libraries: libssl.so.3

9 messages · Page 1 of 1 (latest)

fringe osprey
#

Hey! I'm deploying a Rust app with Docker, my Dockerfile looks like this:

FROM rust:1.71 as build
ARG FEATURES

WORKDIR /app

# Done for dependency caching
COPY Cargo.toml Cargo.lock ./
RUN mkdir -p /app/src && touch /app/src/lib.rs && cargo build --release

COPY src ./src

# Only compile source code
RUN cargo build --release --offline $(if [ -n "$FEATURES" ]; then echo "--features $FEATURES"; fi)

FROM debian:bullseye-slim
RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*

WORKDIR /app

COPY --from=build /app/target/release/app .

CMD ["./app"]

This currently works, however upon trying to update the build image to rust:1.72, it compiles but fails to start up:

./app: error while loading shared libraries: libssl.so.3: cannot open shared object file: No such file or directory

Did something change in Rust 1.72, at least for its Docker image, that would cause this?

amber pendant
#

guessing, but debian probably uses openssl 1.1 and the rust image uses openssl 3

#

openssl is a notoriously touchy library

#

make sure your build environment and runtime environment have the same version

#

Apparently openssl 1.1 reaches EOL in a couple weeks, so that's probably why rust switched. Debian 11 will not update it

#

@fringe osprey

dapper rover
#

Yep I had a simmilar error.
rust:1.72 and onwards use Debian 12 which ships with different versions of almost all packages

#

So if your target is Debian 11, you should stick to the docker container with Debian 11 until your target changes.
I've read somewhere that you can force Debian 12 to compile using the libssl version of Debian 11 but the end result would be the same, its just harder