简体   繁体   中英

Docker ERROR: unsatisfiable constraints when using apk

I am using this as my Dockerfile. On building it, the code exists at step 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

This is what I get on the terminal

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

My Docker version 19.03.3

You just have an unnecessary \ in the RUN command, just before the pip install wheel . Remove it and it will work.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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