26

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
Billy Darwin
  • 465
  • 2
  • 6
  • 11
  • Can you post your entire Dockerfile? – prithajnath Mar 22 '19 at 19:56
  • 4
    Why did you decide that the name of the package is `libssl-dev`? It looks like it is a dev package for openssl in Debian-based distros (https://packages.ubuntu.com/trusty/amd64/libssl-dev/filelist), and in Alpine it is `openssl-dev` (https://pkgs.alpinelinux.org/contents?file=&path=&name=openssl-dev&branch=edge&repo=main&arch=x86_64). – Danila Kiver Mar 22 '19 at 20:17

2 Answers2

40

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
prithajnath
  • 2,000
  • 14
  • 17
  • `libressl-dev` does not seem to work for all settings. With an outdated postgreSQL alpine image I get `ERROR: Service 'xyz' failed to build: The command '/bin/sh -c apk add libressl-dev' returned a non-zero code: 2`. – questionto42 Aug 30 '21 at 13:14
2

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.

questionto42
  • 7,175
  • 4
  • 57
  • 90