【问题标题】:How to add a libpcre3-dev to docker image python3.8-slim when there is no installation candidate没有安装候选时如何将 libpcre3-dev 添加到 docker 映像 python3.8-slim
【发布时间】:2020-06-09 06:34:00
【问题描述】:

我将 Python3.8-slim 映像用于在 uwsgi 上运行的 djangoapp,但 uwsgi 需要 libpcre3-dev 来构建 pcre 支持。

当我添加RUN apt-get install -y libpcre3 libpcre3-dev

FROM python:3.8-slim

...

# Configure apt
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
    && apt-get -y install --no-install-recommends apt-utils 2>&1

...

RUN apt-get install -y libpcre3 libpcre3-dev
RUN pip install uwsgi  # hopefully uwsgi should built with PCRE support now?

到我的 dockerfile,我得到了

E: Package 'libpcre3-dev' has no installation candidate

如何安装?

编辑:这是完整的 Dockerfile: https://github.com/timberline-secondary/hackerspace/blob/f36cafd4c7d97eb989c37bbc9dfdc9c8ddf126c5/Dockerfile

【问题讨论】:

    标签: python-3.x docker uwsgi pcre


    【解决方案1】:

    您在没有 apt-get update 的情况下收到此消息。试试下面的代码。

    RUN apt-get update &&\
     apt-get install -y libpcre3 libpcre3-dev
    

    【讨论】:

    • 抱歉,我之前在 Dockerfile 中运行更新。问题已编辑。谢谢。
    • 您的 docker 文件可以与“apt-get install -y libpcre3 libpcre3-dev”一起正常工作。你有没有在“apt-get autoremove”之后添加“apt-get install -y libpcre3 libpcre3-dev”?
    • 谢谢,但这是在 uwsgi 之后安装的,我认为这意味着 uwsgi 是在没有 pcre 支持的情况下构建的,但根据问题,首先安装这些库的目的。当我在 pip install uwsgi 之前移动该行时,我又得到了错误?!
    • 我在 pip install uwsgi 之前移动了这一行。仍然构建良好。 pastebin.com/duZLjuB9
    • 我不知道我犯了什么愚蠢的错误,但它现在正在建立。谢谢。
    【解决方案2】:

    将你的行替换为

    RUN apt-get update && apt-get install -y libpcre3 libpcre3-dev
    

    【讨论】:

    • 抱歉,我之前在 Dockerfile 中运行更新。问题已编辑。谢谢。
    • 它在链接中(少了 apt-get install -y libpcre3 libpcre3-dev 会破坏它)
    猜你喜欢
    • 2011-01-04
    • 1970-01-01
    • 2021-12-09
    • 2021-07-10
    • 2020-10-12
    • 2020-01-31
    • 2019-11-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多