Docker ERROR: unsatisfiable constraints when using apk
Docker ERROR: unsatisfiable constraints when using apk
我将其用作我的 Docker 文件。在构建它时,代码存在于第 2 步。
FROM python:3.7-alpine
RUN apk update && apk add --no-cache gcc libffi-dev g++ python-dev build-base linux-headers postgresql-dev postgresql-contrib pcre-dev bash alpine-sdk jpeg-dev zlib-dev \ && pip install wheel
COPY ./requirements.txt .
RUN pip install -r requirements.txt
这是我在终端上得到的
Building web
Step 1/18 : FROM python:3.7-alpine
---> 7fbc871584eb
Step 2/18 : RUN apk update && apk add --no-cache gcc libressl libffi-dev g++ python-dev build-base linux-headers postgresql-dev postgresql-contrib pcre-dev bash alpine-sdk jpeg-dev zlib-dev \ && pip install wheel
---> Running in 102a327c46d9
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/community/x86_64/APKINDEX.tar.gz
v3.11.5-56-gd94bd50429 [http://dl-cdn.alpinelinux.org/alpine/v3.11/main]
v3.11.5-54-g70c5111c08 [http://dl-cdn.alpinelinux.org/alpine/v3.11/community]
OK: 11274 distinct packages available
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/community/x86_64/APKINDEX.tar.gz
ERROR: unsatisfiable constraints:
(missing):
required by: world[]
ERROR: Service 'web' failed to build: The command '/bin/sh -c apk update && apk add --no-cache gcc libressl libffi-dev g++ python-dev build-base linux-headers postgresql-dev postgresql-contrib pcre-dev bash alpine-sdk jpeg-dev zlib-dev \ && pip install wheel' returned a non-zero code: 1
我的 Docker 版本 19.03.3
您只是在 RUN
命令中有一个不必要的 \
,就在 pip install wheel
之前。删除它,它将起作用。
RUN apk update && apk add --no-cache gcc libffi-dev g++ python-dev build-base linux-headers postgresql-dev postgresql-contrib pcre-dev bash alpine-sdk jpeg-dev zlib-dev && pip install wheel
我将其用作我的 Docker 文件。在构建它时,代码存在于第 2 步。
FROM python:3.7-alpine
RUN apk update && apk add --no-cache gcc libffi-dev g++ python-dev build-base linux-headers postgresql-dev postgresql-contrib pcre-dev bash alpine-sdk jpeg-dev zlib-dev \ && pip install wheel
COPY ./requirements.txt .
RUN pip install -r requirements.txt
这是我在终端上得到的
Building web
Step 1/18 : FROM python:3.7-alpine
---> 7fbc871584eb
Step 2/18 : RUN apk update && apk add --no-cache gcc libressl libffi-dev g++ python-dev build-base linux-headers postgresql-dev postgresql-contrib pcre-dev bash alpine-sdk jpeg-dev zlib-dev \ && pip install wheel
---> Running in 102a327c46d9
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/community/x86_64/APKINDEX.tar.gz
v3.11.5-56-gd94bd50429 [http://dl-cdn.alpinelinux.org/alpine/v3.11/main]
v3.11.5-54-g70c5111c08 [http://dl-cdn.alpinelinux.org/alpine/v3.11/community]
OK: 11274 distinct packages available
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/community/x86_64/APKINDEX.tar.gz
ERROR: unsatisfiable constraints:
(missing):
required by: world[]
ERROR: Service 'web' failed to build: The command '/bin/sh -c apk update && apk add --no-cache gcc libressl libffi-dev g++ python-dev build-base linux-headers postgresql-dev postgresql-contrib pcre-dev bash alpine-sdk jpeg-dev zlib-dev \ && pip install wheel' returned a non-zero code: 1
我的 Docker 版本 19.03.3
您只是在 RUN
命令中有一个不必要的 \
,就在 pip install wheel
之前。删除它,它将起作用。
RUN apk update && apk add --no-cache gcc libffi-dev g++ python-dev build-base linux-headers postgresql-dev postgresql-contrib pcre-dev bash alpine-sdk jpeg-dev zlib-dev && pip install wheel