I have created a docker multi-stage build to be able to end up with a small, lean container with the most recent nginx version and some modules compiled from source.
At the end I copy over the binary and a few other files to the final container - this works fine.
Additionally I'm trying to set up modsecurity as instructed here: https://www.nginx.com/blog/compiling-and-installing-modsecurity-for-open-source-nginx/
This also works fine in the original build container. Bu when I copy over ngx_http_modsecurity_module.so to the final target container and launch nginx, it fails with:
[emerg] 1#1: dlopen() "/usr/local/nginx/modules/ngx_http_modsecurity_module.so" failed (libmodsecurity.so.3: cannot open shared object file: No such file or directory) in /etc/nginx/nginx.conf:10
The file definitely exists so the error message is neither very precise nor very helpful.
Since it works in the build container I suspect something else is missing but the error message does not give any helpful clues? What could be missing? Where could I look for further clues? Thanks.
PS: I start from debian:stretch-slim image