[quote="sch00lb0y, post:1, topic:36383"]
GLIBC_2.29
[/quote]Search for “install glibc_2.29 docker”. Your binary depends on an external library, known on Linux as a shared object. Search wikipedia for that term if you want to learn more.
Libc in particular is pretty important but I’ll leave it to others to talk about it. You might find good info also searching “libc”.
That error is not because glibc is missing (the rust Docker image has glibc), it's because you compiled the program in an environment with a newer glibc version than the Docker image.
You also don't need to use the rust Docker image at all if you already have your program compiled.
Using a multi-stage Dockerfile you can separate the building/linking-with-musl stage and the "packaging" stage. This way you're left with a small "runner" container that just contains your statically linked, stripped binary. Given the following Dockerfile (in an "example-binary" crate):
FROM ekidd/rust-musl-builder AS builder
ADD . ./
RUN sudo chown -R rust:rust /home/rust/src
RUN cargo build --release
RUN strip /home/rust/src/target/x86_64-unknown-linux-musl/release/example-binary
FROM scratch AS runner
COPY --from=builder /home/rust/src/target/x86_64-unknown-linux-musl/release/example-binary \
/example-binary
ENTRYPOINT [ "/example-binary" ]
...built and tagged an image like so:
$ docker build -t example-binary .
[...build output...]
$ docker image ls example-binary
REPOSITORY TAG IMAGE ID CREATED SIZE
example-binary latest 8ca8ec1b0621 About a minute ago 1.28MB
$ docker run -it example-binary
example-binary 0.1.20
USAGE:
example-binary [OPTIONS] <SUBCOMMAND>
OPTIONS:
-v, --verbose Increase logging verbosity
-h, --help Prints help information
-V, --version Prints version information
SUBCOMMANDS:
help Prints this message or the help of the given subcommand(s)
I have a more complicated Dockerfile which builds both standalone "runner" containers and RPMs (via cargo-rpm)