簡體   English   中英

錯誤:docker 中不可滿足的約束

[英]ERROR: unsatisfiable constraints in docker

我是碼頭工人的新手。

我有兩個問題
問題#1
我創建了這個安裝Apache-AirflowApache-Celery 的基本 docker 文件。 但現在,只想安裝氣流。 我正面臨一個奇怪的問題,說unsatisfiable constraints

錯誤

我累了。 我已經嘗試過但無法解決問題。 任何幫助將不勝感激。

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 的依賴項。

要求.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 image continuumio/miniconda3來安裝依賴項。 這是一個很好的使用方法嗎???

進行了一些更改,這是新的 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
  • cryptography包添加了libffi-dev
  • 為 psycopg2 添加了musl-devpostgresql-dev
  • MySQL-python 不支持 python3,所以我用mysqlclient替換了它
  • mysqlclient添加了mariadb-connect-c-dev
  • 其他小修復、固定復制路徑、刪除重復依賴項

是的,通常你最好不要使用 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"]

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM