[英]Docker: libpython2.7.so.1.0: cannot open shared object file: No such file or directory
Dockerfile Docker文件
FROM python:2.7 as python
CMD ["bash"]
FROM ubuntu
COPY --from=python /usr/local /usr/local
Then, 然后,
docker build -t ubuntuapp .
docker run ubuntuapp /usr/local/bin/python
Output: 输出:
local/bin/python: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory
so, I ran 所以,我跑了
docker run ubuntubr ls /usr/local/lib
Output 输出量
libpython2.7.so
libpython2.7.so.1.0
pkgconfig
python2.7
so why cant it find libpython2.7.so.1.0 when it exists in /usr/local/lib and how do i fix it? 那么,为什么它在/ usr / local / lib中存在时找不到libpython2.7.so.1.0,我该如何解决?
thank you 谢谢
You need to add /usr/local/lib to the list of directories that the linker searches at runtime, and run ldconfig
. 您需要将/ usr / local / lib添加到链接程序在运行时搜索的目录列表,然后运行
ldconfig
。 Append these 2 lines to your Dockerfile: 将这两行添加到您的Dockerfile中:
RUN echo /usr/local/lib > /etc/ld.so.conf.d/local.conf && \
ldconfig
Then I test it with ubuntuapp: 然后我用ubuntuapp进行测试:
$ docker run --rm -it test /usr/local/bin/python
Python 2.7.14 (default, Dec 12 2017, 16:55:09)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.