错误:泊坞窗中的约束无法满足

时间:2020-04-01 13:43:18

标签: linux docker dependencies dockerfile miniconda

我是Docker的新手。

我有两个问题
第1个问题
我已经创建了这个基本的docker文件,该文件安装了 Apache-Airflow Apache-Celery 。但是现在,只想安装气流。我遇到一个奇怪的问题,说unsatisfiable constraints

error

我累了。我已经尝试过但无法解决问题。任何帮助将不胜感激。

FROM python:3.6-alpine
WORKDIR /airflow

RUN apk add git gcc python3-dev gpgme-dev libc-dev python-devel python-setuptools mysql-devel gcc-c++

COPY airflow/requirements.txt airflow/requirements.txt
RUN pip install -r airflow/requirements.txt
COPY . /airflow

EXPOSE 8080 5555

CMD ["airflow", "initdb"]

我有我的requirements.txt文件,该文件具有Apache-Airflow的依赖项。

requirements.txt

pytz==2015.7
cryptography
requests
pyOpenSSL
ndg-httpsclient
pyasn1
psycopg2
celery>=4.0.0
flower>=0.7.3

Flask==1.1.1
requests==2.22.0
airflow==1.10.8
MySQL-python
flask_bcrypt

第2个问题

我们使用conda-library映像continuumio/miniconda3安装依赖项。使用它是一种好方法吗?

1 个答案:

答案 0 :(得分:0)

进行了一些更改,这是新的dockerfile:

FROM python:3.6-alpine
WORKDIR /airflow

RUN apk add build-base libffi-dev musl-dev postgresql-dev mariadb-connector-c-dev

COPY requirements.txt ./requirements.txt
RUN pip install -r requirements.txt
COPY . /airflow

EXPOSE 8080 5555

CMD ["airflow", "initdb"]

以及新的requirements.txt:

pytz==2015.7
cryptography
pyOpenSSL
ndg-httpsclient
pyasn1
psycopg2
celery>=4.0.0
flower>=0.7.3

Flask==1.1.1
requests==2.22.0
apache-airflow==1.10.8
mysqlclient
flask_bcrypt

更改摘要:

  • 您正在尝试下载Alpine中不存在的软件包(它们看起来像debian软件包),我用apk add build-base替换了其中的大部分
  • libffi-dev软件包添加了cryptography
  • 为psycopg2添加了musl-devpostgresql-dev
  • MySQL-python不支持python3,因此我将其替换为mysqlclient
  • mariadb-connect-c-dev添加了mysqlclient
  • 其他次要修补程序,固定的副本路径,已删除的重复依赖项

是的,通常,最好不要使用alpine构建python软件包(https://pythonspeed.com/articles/alpine-docker-python/)。如果切换到continuumio/miniconda3,它会更简单(构建速度也更快)。

FROM continuumio/miniconda3
WORKDIR /airflow

RUN apt-get update && apt-get install -y libpq-dev libmariadbclient-dev build-essential

COPY requirements.txt ./requirements.txt
RUN pip install -r requirements.txt
COPY . /airflow

EXPOSE 8080 5555

CMD ["airflow", "initdb"]