如何在python docker中安装p7zip-full

时间:2019-06-05 05:00:18

标签: docker

我正在使用p7zip-full创建python:2.7-alpine docker。

但是当我构建docker时,出现此错误:

ERROR: unsatisfiable constraints:
  p7zip-full (missing):
    required by: world[p7zip-full]
The command '/bin/sh -c apk add --update --no-cache bind-tools curl coreutils perl bash sudo p7zip-full' returned a non-zero code: 1

这是我的代码:

FROM python:2.7-alpine

MAINTAINER QuangVu

COPY . /app

WORKDIR /app


RUN apk add --no-cache python && \
    python -m ensurepip && \
    rm -r /usr/lib/python*/ensurepip && \
    pip install --upgrade pip setuptools && \
    rm -r /root/.cache

RUN pip install --no-cache-dir -r requirements.txt

RUN apk add --update --no-cache bind-tools curl coreutils perl bash sudo p7zip-full

CMD ["python","test.py"]

如何成功安装p7zip-full

1 个答案:

答案 0 :(得分:0)

在基于python:2.7-alpine的容器中使用apk search p7zip

/ # apk update
fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/community/x86_64/APKINDEX.tar.gz
v3.9.4-10-g358e034123 [http://dl-cdn.alpinelinux.org/alpine/v3.9/main]
v3.9.4-9-g2577e96215 [http://dl-cdn.alpinelinux.org/alpine/v3.9/community]
OK: 9771 distinct packages available
/ # apk search p7zip-full
/ # apk search p7zip
p7zip-doc-16.02-r3
p7zip-16.02-r3

因此,apk回购中只有p7zip,请改用next:

RUN apk add --update --no-cache p7zip