我在 Dockerfile 中使用下面的代码,它构建成功,但没有运行。我怎样才能让它工作?
FROM python:3.5-slim
COPY . /app
WORKDIR /app
RUN apt-get update
RUN apt-get -y upgrade
RUN pip install -r requirements.txt
ENTRYPOINT ["python"]
CMD ["app.py"]
错误:
Traceback (most recent call last):
File "app.py", line 7, in <module>
from my_file.test import test
File "/app/my_file/test.py", line 9, in <module>
from imutils import contours
File "/usr/local/lib/python3.5/site-packages/imutils/__init__.py", line 8, in <module>
from .convenience import translate
File "/usr/local/lib/python3.5/site-packages/imutils/convenience.py", line 6, in <module>
import cv2
File "/usr/local/lib/python3.5/site-packages/cv2/__init__.py", line 3, in <module>
from .cv2 import *
ImportError: libgthread-2.0.so.0: cannot open shared object file: No such file or directory
使用的 Docker 代码:
docker build -t flask-sample-one:latest .
和
docker run -d -p 5000:5000 flask-sample-one
要求文件:
opencv-contrib-python-headless==3.4.3.18
Click==7.0
cloudpickle==0.6.1
cycler==0.10.0
dask==0.20.1
decorator==4.3.0
Flask==1.0.2
imutils==0.5.1
itsdangerous==1.1.0
Jinja2==2.10
kiwisolver==1.0.1
MarkupSafe==1.1.0
networkx==2.2
numpy==1.15.4
Pillow==5.3.0
pyparsing==2.3.0
python-dateutil==2.7.5
PyWavelets==1.0.1
scikit-image==0.14.1
scipy==1.1.0
six==1.11.0
toolz==0.9.0
Werkzeug==0.14.1