7

Can somebody explain to me why I get a

unsatisfiable constraints:
  pdftk (missing):
    required by: world[pdftk]

error when running

apk update
apk add pdftk

in my alpine docker-image, although it seems to be included in alpine?

Best regards

Nemo Grippa
  • 439
  • 1
  • 5
  • 11
  • At the time of writing this, pdftk is available on Alpine 3.8, but not Alpine 3.9 (which is the latest version). I simply reverted to Alpine 3.8 for now to get the desired effect. – conradkleinespel Mar 18 '19 at 14:33
  • Updated answer here: https://stackoverflow.com/questions/66553937/unsatisfiable-constraints-error-when-installing-pdftk-alpine-linux – nicky May 29 '21 at 01:56

1 Answers1

6

It seems there is no local cache of alpine repositories inside your docker image.

So, in order to fix this you can do the following:

1. Use --no-cache flag when you do apk add to not use any local cache path:

$ docker run -ti alpine:3.7
/ # apk add --no-cache pdftk
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
(1/5) Installing libgcc (6.4.0-r5)
(2/5) Installing gmp (6.1.2-r1)
(3/5) Installing libstdc++ (6.4.0-r5)
(4/5) Installing libgcj (6.4.0-r5)
(5/5) Installing pdftk (2.02-r1)
Executing busybox-1.27.2-r7.trigger
OK: 76 MiB in 16 packages

2. Update local cache first (apk update) and then install necessary packages (apk add <package>):

$ docker run -ti alpine:3.7
/ # apk update
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
v3.7.0-159-g08fa87dac2 [http://dl-cdn.alpinelinux.org/alpine/v3.7/main]
v3.7.0-160-g82f356f8c4 [http://dl-cdn.alpinelinux.org/alpine/v3.7/community]
OK: 9050 distinct packages available
/ # apk add pdftk
(1/5) Installing libgcc (6.4.0-r5)
(2/5) Installing gmp (6.1.2-r1)
(3/5) Installing libstdc++ (6.4.0-r5)
(4/5) Installing libgcj (6.4.0-r5)
(5/5) Installing pdftk (2.02-r1)
Executing busybox-1.27.2-r7.trigger
OK: 76 MiB in 16 packages

P.S. Also please remember that pdftk package was added to alpine repositories starting from version 3.5. It could be the case you are using alpine:3.4 as a base docker image.

P.P.S. pdftk package is not present from alpine repositories on 3.9.

Cethy
  • 1,552
  • 2
  • 15
  • 22
nickgryg
  • 25,567
  • 5
  • 77
  • 79