You need to COPY
the libraries into the image before you RUN ldconfig
; volumes won't help you here.
Remember that first you run a docker build
command. That runs all of the commands in the Dockerfile, without any volumes mounted. Then you take that image and docker run
a container from it. Volume mounts only happen when the docker run
happens, but the RUN ldconfig
has already happened.
In your Dockerfile, you should COPY
the files into the image. There's no particular reason to not use the "normal" system directories, since the image has an isolated filesystem.
FROM openjdk:8
# Copy shared-library dependencies in
COPY dist/lib/libsomething.so.1 /usr/lib
RUN ldconfig
# Copy the actual binary to run in and set it as the default container command
COPY dist/bin/something /usr/bin
CMD ["something"]
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…