【发布时间】:2020-01-03 13:53:53
【问题描述】:
我正在尝试在 Docker 中安装 python-ldap,但缺少 lber.h。我需要 python-ldap 因为我正在尝试为我的应用程序实现一个与操作系统无关的 SSO,现在遵循这个并希望它不会破坏我的应用程序的其余部分 https://code.tutsplus.com/tutorials/flask-authentication-with-ldap--cms-23101
我试过了
RUN apk add libsasl2-dev libldap2-dev libssl-dev
和
RUN apk --no-cache add libsasl2-dev libldap2-dev libssl-dev
但我收到以下错误:
ERROR: unsatisfiable constraints:
libldap2-dev (missing):
required by: world[libldap2-dev]
libsasl2-dev (missing):
required by: world[libsasl2-dev]
libssl-dev (missing):
required by: world[libssl-dev]
去了https://pkgs.alpinelinux.org/packages?name=libldap2-dev&branch=edge我觉得这些包可能确实不存在于alpine python镜像中。因此,我尝试用上面链接中存在的包替换安装,即:openssl libsasl libldap 这也不起作用,并且与不安装任何软件包具有相同的效果,即出现标头丢失错误:
Modules/constants.h:7:10:致命错误:lber.h:没有这样的文件或目录
#include "lber.h"
^~~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1
由于/tmp/pip-install-doifa8k9/python-ldap/
我的 Dockerfile:
FROM python:3.8.0-alpine
WORKDIR /home/flask
ADD . /home/flask
RUN apk --no-cache add --update --virtual .build-editdistance gcc g++ && \
apk --no-cache add libsasl libldap openssl && \
apk --no-cache add --update --virtual .libs libstdc++ && \
apk add linux-headers && \
apk add unixodbc-dev;
RUN rm -rf /var/cache/apk/* && \
pip install --upgrade pip && \
pip install --upgrade setuptools && \
pip install --no-cache-dir -Ur requirements.txt && \
apk del .build-editdistance;
EXPOSE 5000
【问题讨论】:
标签: python-3.x docker ldap