You need to compile your binary with --target=x86_64-unknown-linux-musl
For that purpose you either need to have musl libraries installed or you can use rust docker image for alpine
Even official docker images provide you with alpine version Image Layer Details - rust:alpine3.15 | Docker Hub which you can use to compile your binary.
Also do not listen to @sanxiyn Alpine is preferable for deployment due to its small size, so I would advice to investigate tooling for musl cross-compilation (in your case docker is already providing you with it)
OP clearly stated "code is not compiled inside docker", so I don't think this is a useful advice.
Yes, you can try to cross compile to use musl C library, but if you compile on Ubuntu, running on Ubuntu would cause the least amount of hassle. You can investigate size optimization later once it works.