Alpine Linux: install / pin old packages
• 112 words • 1 min • updated
⚠️ This post is over one year old. It may no longer be up to date or relevant. Opinions may have changed.
Let’s say you want to install an older version of jq in Alpine Linux.
For example:
- Alpine v3.18 has
jq1.6 - Alpine v3.19 has
jq1.7
You’re probably using Alpine v3.21 or edge today, which has an even newer
version of jq. Hence doas apk add jq will not do.
Let’s assume you do not want to edit your /etc/apk/repositories, as this is an
one-off, for a single package. What can you do then?
Use the --repository flag from apk!
shell
% doas apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/v3.18/main jq=~1.6It’s also important to pin the package version (~1.6), otherwise the latest
one available gets installed.
Replace “main” with “community” or “testing” as needed.
Backlinks
- Alpine Linux: Dockerfile: install package from edge (Jun 04, 2025)