Alpine Linux Package Management + Practice
A hands-on overview of Alpine package management with apk, including update, add, delete, search, inspect, verify, and graphing package dependencies.
This post is a practical introduction to Alpine Linux package management using apk.
I used Docker from macOS to spin up Alpine locally:
docker run -it alpine sh
uname -a
cat /etc/os-release
A quick apk mental model
apk-tools gives Alpine its package manager. The most common commands you will use are:
apk addto install packagesapk delto remove packagesapk updateto refresh package indexesapk upgradeto upgrade installed packagesapk infoandapk searchto inspect packagesapk verify,apk audit,apk policy, andapk dotfor deeper inspection
What happens when you run apk update?
apk update downloads package index archives from configured repositories and stores them locally. This is why it is usually smart to run it before apk add or apk upgrade.
apk update
ls /var/cache/apk
Installing and removing packages
apk add nginx
cat /etc/apk/world
apk add openssh
apk del openssh
The /etc/apk/world file is important because it tracks the explicitly requested packages that define the desired system state.
Upgrading a system
apk update
apk upgrade
# or
apk -U upgrade
Searching and inspecting packages
apk search -v
apk search -v --description 'NTP'
apk search -v 'cmd:git'
apk info -a zlib
apk info --who-owns /sbin/watchdog
These commands are useful when you want to understand what a package provides, what depends on it, and which files belong to it.
Graphing dependencies with apk dot
apk dot can generate Graphviz output for package relationships. That is a fun and useful way to inspect package dependency graphs.
apk dot seatd > seatd_dependencies.dot
apk add graphviz
dot -Tpng seatd_dependencies.dot -o seatd_dependencies.png
Useful references
More posts
CRUD K8s Deployment Implementation using client-go and k8s io api
Feb 20, 2025 6 min readA practical walkthrough for implementing create, read, update, and delete operations for Kubernetes Deployments using client-go, Gin, and YAML input handling.
Websocket and Informer Implementation in Golang (Custom K8s Controller)
Feb 18, 2025 7 min readA walkthrough of using Kubernetes informers and a workqueue to stream deployment changes over WebSocket in a custom Go controller.
Introduction to Witness: Verifying Software Supply Chain Attestations
Aug 23, 2025 3 min readA practical introduction to Witness: generating keys, recording attestations, signing policy, and verifying a simple Go binary against supply chain requirements.
Written by Rahul Vishwakarma — this is the first-party home for this article on rahulxf.com. A copy also lives on Medium .