【问题标题】:Docker python3.8 alpine python-ldab installation fails missing lber.hDocker python3.8 alpine python-ldab 安装失败缺少 lber.h
【发布时间】: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


    【解决方案1】:

    对于 docker 中的 alpine python:

    apk add openldap-dev
    

    而不是

    apk add libsasl libldap openssl
    

    这在I can't install python-ldap 中得到了回答,但答案被埋得足够深,并且被接受的答案(这是 libsasl libldap openssl 的来源)混淆了,因此保留这个 docker 特定问题是个好主意

    【讨论】:

      猜你喜欢
      • 2020-09-21
      • 2019-02-11
      • 1970-01-01
      • 2021-08-22
      • 1970-01-01
      • 2019-11-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多