Distroless Docker image fails with `libc.so: cannot open shared object file: No such file`
I am building a 1:1 with a Node project using the same base for a docker image
distroless/cc
. Both projects use the same external dependency pulled from npm
called libsql
however the Deno project seems to fail with the following error
I am unsure where to direct this issue as I can see that the container does include a file under /lib/x86_64-linux-gnu
directory.
Here is my current dockerfile
Any suggestions?3 Replies
Based on the documentation, it seems like you're trying to build a Docker image for your Deno application using the
denoland/deno:distroless-${DENO_VERSION}
image as a base. The error message you're seeing suggests that the libc.so
shared library file cannot be found.
The libc.so
file is a standard C library that's used by many programs on Linux, including some Node.js and Deno dependencies. If this file is missing or not found, it can cause errors like the one you're seeing.
The denoland/deno:distroless-${DENO_VERSION}
image is a minimal image that only includes the Deno runtime and its dependencies. It's possible that this image doesn't include the libc.so
file, or that it's located in a different directory than where your application is looking for it.
One thing you could try is to use a different base image that includes a more complete set of standard Linux libraries. For example, you could try using the denoland/deno:debian-${DENO_VERSION}
image instead. This image is based on Debian, which is a more full-featured Linux distribution.
Here's how you could modify your Dockerfile to use this image:
If this doesn't solve your problem, it might be helpful to provide more information about the libsql
dependency that you're using. Is this a native Node.js module that requires compilation? If so, you might need to install additional build toolsin your Docker image to compile this module.
Libsql is an npm module correct. I will try the Debian package but would prefer the build on top of a distroless image. I will also check with the libsql maintainers as the node application seemed to build just fine, it's just the deno one with the complications