When I install Python project, I get this error with Docker. I did not find a solution despite researching on the google. By the way When I run project on Docker, how to display on browser ?
test@test-VirtualBox:~/backend$ sudo docker build -t test .
Sending build context to Docker daemon 489kB
Step 1/11 : FROM python:3.6-alpine
---> 267db919e15e
Step 2/11 : RUN addgroup -S app && adduser -S -g app app
---> Using cache
---> ce1632a22469
Step 3/11 : WORKDIR /usr/src/app
---> Using cache
---> 01b36ea9b7c1
Step 4/11 : RUN apk --update --upgrade add --virtual deps gcc python3-dev linux-headers musl-dev alpine-sdk openssl-dev gmp-dev libffi-dev postgresql-dev && apk --update --upgrade add --no-cache libpq gmp
---> Running in d962dfc4a26a
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/community/x86_64/APKINDEX.tar.gz
ERROR: unsatisfiable constraints:
openssl-dev-1.0.2o-r2:
conflicts:
libressl-dev-2.7.4-r0[pc:libcrypto=1.0.2o]
libressl-dev-2.7.4-r0[pc:libssl=1.0.2o]
libressl-dev-2.7.4-r0[pc:openssl=1.0.2o]
libressl-dev-2.7.4-r0:
conflicts:
openssl-dev-1.0.2o-r2[pc:libcrypto=2.7.4]
openssl-dev-1.0.2o-r2[pc:libssl=2.7.4]
openssl-dev-1.0.2o-r2[pc:openssl=2.7.4]
satisfies:
postgresql-dev-10.5-r0[libressl-dev]
deps-0:
masked in: cache
satisfies: world[deps]
The command '/bin/sh -c apk --update --upgrade add --virtual deps gcc python3-dev linux-headers musl-dev alpine-sdk openssl-dev gmp-dev libffi-dev postgresql-dev && apk --update --upgrade add --no-cache libpq gmp' returned a non-zero code: 4
Dockerfile:
FROM python:3.6-alpine
RUN addgroup -S app && adduser -S -g app app
WORKDIR /usr/src/app
RUN apk --update --upgrade add --virtual deps \
gcc python3-dev linux-headers musl-dev \
alpine-sdk gmp-dev libffi-dev \
postgresql-dev && \
apk --update --upgrade add --no-cache libpq gmp
COPY ./requirements.txt requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
RUN apk del deps
COPY . /usr/src/app
RUN chown -R app:app /usr/src/app
USER app
EXPOSE 8080
Why do you need to install openssl-dev
package? Alpine packages are compiled with libressl
. You can't install both openssl-dev
and libressl-dev
in container with alphine 3.6.
I've met the same problem. Our company build a base image based on python:2.7-alpine
, but maybe it is too old. So don't install openssl-dev
is not enough.
Look this :
satisfies:
postgresql-dev-10.5-r0[libressl-dev]
postgresql-dev
rely on libressl-dev
, so I delete openssl-dev firstly:
RUN apk del openssl-dev
Then everything is ok.
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.