Things I wish I knew earlier: Alpine Linux cmd package alias

Daniel Megyesi
Infrastructure adventures
2 min readFeb 10, 2023

I had to Google countless times what is the damn package name in Alpine Linux to install a simple dig or telnet command.

Seriously, who can remember bind-utils or inetutils-telnet?

To the rescue: Alpine has the cmd: alias:

$ docker run --rm -ti alpine:3.17
/ # apk add -u dig
fetch https://dl-cdn.alpinelinux.org/alpine/v3.17/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.17/community/x86_64/APKINDEX.tar.gz
ERROR: unable to select packages:
dig (no such package):
required by: world[dig]

/ # apk add -u cmd:dig
(1/15) Upgrading libcrypto3 (3.0.7-r2 -> 3.0.8-r0)
(2/15) Upgrading libssl3 (3.0.7-r2 -> 3.0.8-r0)
(3/15) Installing fstrm (0.6.1-r1)
(4/15) Installing krb5-conf (1.0-r2)
(5/15) Installing libcom_err (1.46.5-r4)
(6/15) Installing keyutils-libs (1.6.3-r1)
(7/15) Installing libverto (0.3.2-r1)
(8/15) Installing krb5-libs (1.20.1-r0)
(9/15) Installing nghttp2-libs (1.51.0-r0)
(10/15) Installing protobuf-c (1.4.1-r1)
(11/15) Installing libuv (1.44.2-r0)
(12/15) Installing xz-libs (5.2.9-r0)
(13/15) Installing libxml2 (2.10.3-r1)
(14/15) Installing bind-libs (9.18.11-r0)
(15/15) Installing bind-tools (9.18.11-r0)
Executing busybox-1.35.0-r29.trigger
OK: 19 MiB in 28 packages

/ # which dig
/usr/bin/dig

I wish I knew this in the past couple of years; Stackoverflow would have lost so much unnecessary traffic.

Photo by David Matos on Unsplash

Disclaimer: as the Alpine Package Keeper docs state that this alias is not foolproof if there are multiple packages containing the same binary, but it gets the job done for the typical use case.

--

--