Issue with 1.25.1-distroless Image Version
Description:
I faced errors while using the 1.25.1-distroless
image for my Docker setup. When I tried running the image directly, the following errors occurred:
$:docker run registry1.dso.mil/ironbank/opensource/nginx/nginx:1.25.1-distroless
nginx: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by nginx)
nginx: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by nginx)
nginx: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by nginx)
nginx: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.36' not found (required by /lib/x86_64-linux-gnu/libcrypt.so.1)
nginx: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /usr/lib/x86_64-linux-gnu/libssl.so.3)
nginx: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /lib/x86_64-linux-gnu/libcrypto.so.3)
nginx: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /lib/x86_64-linux-gnu/libcrypto.so.3)
To fix this, I attempted to copy missing libraries from nginxinc/nginx-unprivileged:1.25.1
, but the container exited with a non-zero code. I also tried running nginx manually within the container, but it crashed with a "Segmentation fault."
Solution:
After several tries, I found a solution by building the nginx-distroless
image from nginxinc/nginx-unprivileged:1.25.1-alpine
, and this resolved the errors.
I've included this Dockerfile example to show how I did it.
Note:
I acknowledge there are DNS-related risks associated with using Alpine images, discussed in these references:
- https://martinheinz.dev/blog/92
- https://purplecarrot.co.uk/post/2021-09-04-does_alpine-resolve_dns_properly/
If you decide to use libraries from the alpine nginx image, it might be helpful to include alpine
in the version tag.