ERROR: unsatisfiable constraints in docker
ERROR: unsatisfiable constraints in docker
我是 docker 的新手。
我有两个问题
问题 #1
我创建了这个安装 Apache-Airflow 和 Apache-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 的依赖项。
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
来安装依赖。这是一个好的使用方法吗???
进行了一些更改,这是新的 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-dev
和 postgresql-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"]
我是 docker 的新手。
我有两个问题
问题 #1
我创建了这个安装 Apache-Airflow 和 Apache-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 的依赖项。
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
来安装依赖。这是一个好的使用方法吗???
进行了一些更改,这是新的 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-dev
和postgresql-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"]