简体   繁体   English

在Docker镜像中安装argon2(安装gcc的问题)

[英]Install argon2 in Docker image (problem with installing gcc)

right now I'm trying to setup argon2 in a docker image.现在我正在尝试在 docker 映像中设置 argon2。 Apparently I have to install gcc before (and I don't just want to install it on my local machine).显然我之前必须安装 gcc (而且我不只是想在我的本地机器上安装它)。 My Dockerfile looks like this:我的Dockerfile看起来像这样:

FROM python:3.6-alpine
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY requirements.txt /usr/src/app/
RUN apt install -y gcc && \
pip3 install --no-cache-dir -r requirements.txt
COPY . /usr/src/app
EXPOSE 8080
ENTRYPOINT ["python3"]
CMD ["argon.py"]

and my requirements.txt look like this:我的requirements.txt看起来像这样:

flask
flask_restful
connexion == 2.2.0
python_dateutil == 2.6.0
setuptools >= 21.0.0
swagger-ui-bundle
argon2-cffi

When I try to build my docker container like this I get an error: "/bin/sh: apt: not found"当我尝试像这样构建我的 docker 容器时,出现错误:“/bin/sh: apt: not found”

I'm trying this on ubuntu server 18.04 if this is relevant.如果相关,我正在 ubuntu 服务器 18.04 上尝试此操作。

Like Klaus D. said, I had to use apk instead of apt.就像 Klaus D. 说的,我不得不使用 apk 而不是 apt。 Also I had to install some more dependencies than only gcc.此外,我必须安装比 gcc 更多的依赖项。 So my Dockerfile looks like this now:所以我的 Dockerfile 现在看起来像这样:

RUN apk add gcc musl-dev libffi-dev && \
    pip install -U  cffi pip setuptools && \
    pip3 install --no-cache-dir -r requirements.txt

This solved my problem and let me use argon2d.这解决了我的问题,让我使用 argon2d。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM