Fork me on GitHub

Hi, I’m getting cannot open shared object file: No such file or directory when I attempt to run my uberjar with embeded Datalevin in Docker. My Dockerfile has a build stage creating the uberjar using clojure:openjdk-11-lein-buster and the final stage utilizes`openjdk:11-slim-buster` to run the jar. I also tried changing both to non-`slim`, but I got the same error. App is based on the Luminus template and works great in dev mode (`lein run`). Are there some libs/packages that needs to be installed or other prerequisites for it to work inside a container? I guess it shouldn’t be an issue as the images supports my architecture, but right now I’m running this is on a MacBook Pro with an M1Pro chip. Prod server will be Ubuntu. PS: Going to bed now, so it will take a while to respond to any follow-ups, but I’ll appreciate any tips here.


Not sure. LMDBJava extracts the LMDB shared library into Java’s default tmp directory, e.g. it will generate a file /tmp/ , load that to use, and finally will delete it on JVM exit. I don’t know how this whole thing plays out in a docker environment.


The error indicates that the linker tried to load in its default location but failed. I am not sure why it tried to do that, as the LMDBJava extracted library will have a random name, it’s a temporary file.


so I think you need to make a /tmp available for your docker container, e.g. bind host /tmp to it, or mount a tmpfs volume, or something else.


finally, my understanding is that docker images is tied to CPU architecture, so I am not sure that you can run an amd64 docker image on M1 chip?


the answer is probably no. this also explains why the linker tried to load instead of a random named one, because it cannot find the right native library with correct architecture, so it failed back to the default name.


In any case, it is premature for a developer machine to switch to Apple silicon at this point. The ecosystem is just not there yet. Apple doesn’t really care about Java and Linux, so you are on your own if that’s where your deployment will be. It will take a while for the ecosystem to mature, I guess.


Honestly, I personally SSH into a Linux workstation to write code. A laptop is just for browsing and hosting a terminal. I would recommend any backend engineers to do that same.