Hello,
I just wanted to leave this here so that people may find the solution right away. I found the solution on another post somewhere on the internet, but I've lost the original source.
If you're getting this error:
Can't open lib '/opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.10.so.6.1'
Check your base image as libmsodbcsql-17 may not support it; for example it doesn't suppport Debian Trixie yet.