Dockerfile
FROM docker as docker
CMD ["bash"]
FROM python:2.7-slim as python
CMD ["bash"]
# base image
FROM ubuntu
COPY --from=docker /usr/local/ /usr/local/
COPY --from=python /usr/local/ /usr/local/
CMD ["ls", "/usr/local/bin"]
然后,
docker build -t test .
docker run test
输出:
2to3
docker
docker-containerd
docker-containerd-ctr
docker-containerd-shim
docker-entrypoint.sh
docker-init
docker-proxy
docker-runc
dockerd
easy_install
easy_install-2.7
idle
modprobe
pip
pip2
pip2.7
pydoc
python
python-config
python2
python2-config
python2.7
python2.7-config
smtpd.p
很好,我看到了python和docker二进制文件。但是,如果我尝试运行它..
docker run test /usr/local/bin/python --version
/usr/local/bin/python: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory
我不认为复制/ usr / local就足够了吗? 还有什么办法让python在ubuntu中工作?