Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install older package version in Alpine

So recently (5th September) the Alpine Linux package repo was updated to postgresql-client 12.4

I'm referencing version 12.3 in my Dockerfile (apk add postgresql-client=~12.3). Is it not possible to install that version now?

I'd like to update on my time and terms, why should I be forced to update now? Is there another repository I can add to use the older version?

Thanks

like image 727
Steve Folly Avatar asked Jan 24 '23 17:01

Steve Folly


1 Answers

Unfortunately, Alpine packages are always updated in place to the latest version, and older versions are discarded. This could be painful, indeed...

Usually, when a package is updated, it's updated with all Alpine distro versions that it's compatible to. For example, postgresql-client was bumped to 12.4-r0 on edge, v3.12 and v3.11, but on Alpine v3.10 repos you'll still find 11.9-r0. In case this was enough, the old version could be installed from the desired repository, as long as it lasts, using:

apk add postgresql-client=11.9-r0 --repository=http://dl-cdn.alpinelinux.org/alpine/v3.10/main

However, since 12.3 doesn't live in the official Alpine repositories anymore, you could rely on an external Docker image, instead.

Luckily, the postgres official images has version tags, and you can find the desired Alpine image for 12.3:

$ wget -q https://registry.hub.docker.com/v1/repositories/postgres/tags -O - | jq -r '.[].name' | grep 12.3
12.3  
12.3-alpine

Therefore, you can use FROM:postgres:12.3-alpine to get the desired version from.

In tougher cases, where the Alpine package version is updated, and couldn't be found in other images, the only resort may be building from source.

like image 55
valiano Avatar answered Mar 15 '23 21:03

valiano