简体   繁体   中英

ERROR: unsatisfiable constraints in docker

I am new to docker.

I have two questions
Question # 1
I've created this basic docker file that installs the Apache-Airflow and Apache-Celery . But for now, just wanted to install airflow. I am facing a strange issue saying unsatisfiable constraints .

错误

I'm getting tired. I've tried but not able to resolve the issue. Any help will be appreciated a lot.

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"]

I've my requirements.txt file which has the dependencies for 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

Question # 2

We use conda-library image continuumio/miniconda3 to install the dependencies. Is it a good approach to use???

Made a few changes, here's the new 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"]

And the new 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

Summary of changes:

  • You were trying to download packages that don't exist in Alpine (they look like debian packages), I replaced most of them with apk add build-base
  • added libffi-dev for the cryptography package
  • added musl-dev and postgresql-dev for psycopg2
  • MySQL-python doesn't support python3 so I replaced it with mysqlclient
  • added mariadb-connect-c-dev for mysqlclient
  • other minor fixes, fixed copy paths, removed duplicate dependencies

And yes, generally you might be better off not using alpine to build python packages ( https://pythonspeed.com/articles/alpine-docker-python/ ) . If you switch to continuumio/miniconda3 it is a little simpler (and much faster to build).

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"]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM