dynamic链接caching在Docker应用程序中被忽略
我试图在Docker容器应用程序中使用dynamic链接caching( /etc/ld.so.cache
),但应用程序没有使用caching来parsing运行时path。 在我的Dockerfile
有:
COPY myapp.conf /etc/ld.so.conf.d/ RUN ldconfig USER myuser
但是当我构build图像并运行应用程序时,我得到:
cannot open shared object file: No such file or directory
但是,在环境中设置path:
USER myuser ENV LD_LIBRARY_PATH="PATH=/path/to/my/libs:${LD_LIBRARY_PATH}"
我也可以这样testing图片:
docker run --rm myimage ldconfig -v | grep mylib
它find了图书馆。
容器以非root用户身份运行,这可能与它有关。 但是,它仍然无法find共享对象:
docker run --rm --user=root myimage