x-ray
x-ray

Reputation: 3329

PostgreSQL 9.6.9 on Alpine Linux (arm32v6) in Docker container - how to install correct postgresql-contrib package?

I need to install PostgreSQL 9.6.9 with uuid-ossp support in a Docker container on a 32-bit ARM system (its a QNAP NAS, CPU: Annapurna Labs Alpine AL-314).

I found the arm32v6/postgres images and installed arm32v6/postgres:9.6.9-alpine. This is working smoothly, but lacks the postgresql-contrib package. As far as I understand, I need to install postgresql-contrib to get uuid-ossp support.

I opened a CLI in the container and tried:

# apk update
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/armhf/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/armhf/APKINDEX.tar.gz
v3.7.0-215-g16971064c0 [http://dl-cdn.alpinelinux.org/alpine/v3.7/main]
v3.7.0-207-gac61833f9b [http://dl-cdn.alpinelinux.org/alpine/v3.7/community]
OK: 8879 distinct packages available
# apk add postgresql-contrib=9.6.9-r0
ERROR: unsatisfiable constraints:
  postgresql-contrib-10.4-r0:
    breaks: world[postgresql-contrib=9.6.9-r0]

How can I install the correct version of postgresql-contrib? Or can I just use postgresql-contrib-10.4-r0 with PostgreSQL 9.6.9?

Upvotes: 3

Views: 15576

Answers (2)

x-ray
x-ray

Reputation: 3329

I found out that the arm32v6/postgres:9.6.9-alpine Docker image does have uuid-ossp support out of the box. The image seems to be compiled with (some?) postgres-contrib modules. A look into the Dockerfile might help.

Upvotes: 0

Jakub Jirutka
Jakub Jirutka

Reputation: 10817

Just use base alpine image and install PostgreSQL completely from Alpine's official packages: postgresql and postgresql-contrib. The last stable Alpine providing PostgreSQL 9.6 is v3.6, which is two versions behind, but still supported. Alpine v3.7 provides only 10.4.

Also don't specify exact version to apk add. Alpine provides only single version of the package per branch (e.g. v3.7, v3.8, edge). Once we release postgresql-contrib 9.6.9-r1 or 9.6.10-r0 (e.g. fixing some security issue), 9.6.9-r0 will not be available anymore and your apk add postgresql-contrib=9.6.9-r0 will fail.

These specialized Docker images “packaging” something that is already properly packaged in Alpine are mostly totally useless and just causes confusions and problems. I can't even count how many times I'm responding to this type of issue on SO.

Upvotes: 8

Related Questions