Billy Darwin
Billy Darwin

Reputation: 525

Install libssl-dev for Docker

I'm building an image for Docker and it's giving me error:

ERROR: unsatisfiable constraints:
libssl-dev (missing):
required by: world[libssl-dev]

running RUN apk add libssl-dev doesn't seem to help. What can I do to resolve this ?

Dockerfile-dev:

FROM python:3.6.7-alpine

WORKDIR /usr/src/app

COPY ./requirements.txt /usr/src/app/requirements.txt
RUN apk add libssl-dev
RUN apk add libffi-dev
RUN apk add --update python3 python3-dev py-pip build-base
RUN pip3 install -r requirements.txt

COPY . /usr/src/app

CMD python3 manage.py run -h 0.0.0.0

Upvotes: 28

Views: 44324

Answers (2)

questionto42
questionto42

Reputation: 9502

I am just a beginner at apk packages and their dependency conflicts. No guarantees for anything, I just hope it helps someone.

From LibreSSL:

LibreSSL is a version of the TLS/crypto stack forked from OpenSSL in 2014, with goals of modernizing the codebase, improving security, and applying best practice development processes.

Both openssl-dev and libressl-dev depend on libssl. If you install one of the two, you will probably install libssl-dev with it. At least, after running (taken from https://github.com/gliderlabs/docker-alpine/issues/297):

RUN apk add gcc musl-dev python3-dev libffi-dev openssl-dev

I got this conflict by running (taken from Installing pandas in docker Alpine, probably not necessary in my case anyway):

RUN apk add postgresql-dev libxml2 libxml2-dev libxslt libxslt-dev libjpeg-turbo-dev zlib-dev

Which outputs:

ERROR: unsatisfiable constraints:
  openssl-dev-1.0.2t-r0:
    conflicts:
               libressl-dev-2.6.5-r0[pc:libcrypto=1.0.2t]
               libressl-dev-2.6.5-r0[pc:libssl=1.0.2t]
               libressl-dev-2.6.5-r0[pc:openssl=1.0.2t]
    satisfies: world[openssl-dev]
  libressl-dev-2.6.5-r0:
    conflicts:
               openssl-dev-1.0.2t-r0[pc:libcrypto=2.6.5]
               openssl-dev-1.0.2t-r0[pc:libssl=2.6.5]
               openssl-dev-1.0.2t-r0[pc:openssl=2.6.5]
    satisfies:
               postgresql-dev-10.10-r0[libressl-dev]

We see that the conflict is caused by installing openssl-dev and postgresql-dev.

In this case, it seems that this version of openssl has younger dependencies since the seemingly newer openssl-dev-1.0.2t-r0 (latest version seems to be 1.1.1 in 8/2021, see OpenSSL) conflicts with the older libssl=1.0.2t while the older libressl-dev-2.6.5-r0 (latest version is already 3.4 in 8/2021) conflicts with the younger libssl=2.6.5.

From all this, I read that libssl gets installed as a dependency by openssl-dev or libressl-dev, the latter of which seems to be installed for example by packages like postgresql-dev.

Upvotes: 3

prithajnath
prithajnath

Reputation: 2115

Some packages are built against libressl in Alpine 3.6. Try replacing line 6 in your Dockerfile with the following

RUN apk add libressl-dev

Upvotes: 43

Related Questions