Dockerfile中的pip安装失败 [英] pip install in Dockerfile is failing

查看:1182
本文介绍了Dockerfile中的pip安装失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为我的应用创建了一个Dockerfile,如下所示,但是当我尝试构建dockerimage时失败了.

Hi I have created a Dockerfile for my app as below but it failed when I try to build the dockerimage .

FROM python:alpine3.7
COPY . /app
WORKDIR /app
RUN pip install --upgrade pip
RUN pip install -r requirements.txt
CMD python ./index.py

这是requirements.txt的内容

here is the content of requirements.txt

flask
numpy
pandas 
SQLAlchemy
pyodbc

在开始运行pip install -r requirements.txt时 它可以安装flask,但是在numpy和pandas之间看起来像,它开始在许多页面中产生错误.

when it gets to RUN pip install -r requirements.txt it can install flask but after that look like between numpy and pandas it start to generate error for many many pages.

有什么帮助吗?

推荐答案

编辑您的dockerfile:

FROM python:alpine3.7
RUN apk update && apk add --no-cache gcc g++ python3-dev unixodbc-dev
COPY . /app
WORKDIR /app
RUN pip install --upgrade pip
RUN pip install -r requirements.txt
CMD python ./index.py

编辑您的requirements.txt

flask 
SQLAlchemy
pyodbc
pandas
numpy

这篇关于Dockerfile中的pip安装失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆