【问题标题】:How to Have Pycrypto at Docker Properly Working?如何让 Docker 上的 Pycrypto 正常工作?
【发布时间】:2020-01-07 11:48:22
【问题描述】:

我在 AWS lambda 上成功使用了 Pychromeless repo

但现在我需要使用 pycrypto 依赖,但我得到了

configure: error: no acceptable C compiler found in $PATH 运行时make docker-build (将pycrypto==2.6.1 放在requirements.txt 文件之后)。

this thread 有人说同样的问题:

“gcc 编译器不在您的 $PATH 中。这意味着您没有安装 gcc 或者它不在您的 $PATH 变量中”。

所以尝试将apt-get install build-essential 放在 Dockerfile 中,但我得到了

/bin/sh: apt-get: command not found

然后,我尝试使用yum install gcc

只为得到

The command '/bin/sh -c yum install gcc' returned a non-zero code: 1

Docker-lambda [信息页面] (https://hub.docker.com/r/lambci/lambda/) 说:

This project consists of a set of Docker images for each of the supported Lambda runtimes.

There are also a set of build images that include packages like gcc-c++, git, zip and the aws-cli for compiling and deploying.

所以我想我不需要安装 gcc。可能 gcc 编译器不在 $PATH 中,但我不知道如何解决这个问题。

这里是 dockerfile

FROM lambci/lambda:python3.6
MAINTAINER tech@21buttons.com

USER root

ENV APP_DIR /var/task

WORKDIR $APP_DIR

COPY requirements.txt .
COPY bin ./bin
COPY lib ./lib

RUN mkdir -p $APP_DIR/lib
RUN pip3 install -r requirements.txt -t /var/task/lib

对解决这个问题有帮助吗?

【问题讨论】:

  • RUN yum update -y && yum install -y gcc 安装gcc
  • @masseyb:同样的答案:Service 'lambda' failed to build: The command '/bin/sh -c yum update -y && yum install -y gcc' returned a non-zero code: 1
  • 那张lambci/lambda 图像基于什么?它是由什么构成的?
  • 他们说:There are also a set of build images that include packages like gcc-c++, git, zip and the aws-cli for compiling and deploying.

标签: python-3.x docker dockerfile pycrypto


【解决方案1】:

嗯,嗯,嗯……今天对我来说是幸运的一天。

如此简单:我所要做的就是替换

pycrypto==2.6.1

pycryptodome

在我的 requirements.txt 文件中。

这个thread 说:“强烈建议不要使用 pycrypto。它很旧且没有维护,并且包含许多漏洞。请改用 pycryptodome - 它兼容且是最新的”。

就是这样!使用 pycryptodome 构建 Docker 就好了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-04-10
    • 1970-01-01
    • 2015-05-08
    • 2020-08-27
    • 2018-06-11
    • 2016-08-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多