[英]Installing pip packages in python Docker container
我正在尝试设置运行python 2.7的Docker镜像。 我想在容器中运行的代码依赖于我在构建Docker镜像期间尝试使用pip的包。 我的问题是pip只会在尝试获取其他包时发现错误的一部分包。 这是我的Docker文件:
# Use an official Python runtime as a parent image
FROM python:2.7-slim
# Set the working directory to /app
WORKDIR /app
# Copy the current directory contents into the container at /app
ADD . /app
# Install any needed packages specified in requirements.txt
RUN pip install --trusted-host pypi.python.org -r requirements.txt
# Make port 80 available to the world outside this container
EXPOSE 80
# Define environment variable
ENV NAME World
# Run app.py when the container launches
CMD ["python", "./my_script.py"]
这里是requiremnts.txt
Flask
redis
time
sys
opcua
Pip收集Flask和redis没有问题,但是在收集时间方面会出错( sys和opcua也有同样的问题)
我该怎么做才能使它适用于所有pip包? 提前致谢!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.