apk
Alpine Linux package manager
TLDR
Refresh the package index
$ apk update
Install packages$ apk add [package1] [package2]
Install without leaving an index cache behind, as in a Dockerfile$ apk add --no-cache [package]
Install build dependencies under a virtual name$ apk add --virtual [.build-deps] [gcc] [make]
Drop that whole group again in one command$ apk del [.build-deps]
Upgrade everything after refreshing the index$ apk upgrade --update-cache
Preview a change without applying it$ apk add --simulate [package]
Search by name, listing descriptions$ apk search --verbose [keyword]
Search inside descriptions$ apk search --description [keyword]
Show a package's details$ apk info [package]
Find which package owns a file$ apk info --who-owns [/usr/bin/ssh]
List the files a package installed$ apk info --contents [package]
List everything installed$ apk list --installed
Repair a package without touching its dependencies$ apk fix [package]
SYNOPSIS
apk [options] command [arguments]
DESCRIPTION
apk (Alpine Package Keeper) is the package management tool for Alpine Linux. It handles installation, upgrade, and removal of packages, as well as repository management and system maintenance.
PARAMETERS
add
Add or modify constraints and commit changesdel
Remove constraints and commit changesfix
Fix, reinstall, or upgrade packages without modifying worldupdate
Update repository indexesupgrade
Install upgrades available from repositoriescache
Manage the local package cachesearch
Search for packages by name or descriptioninfo
Display detailed information about packageslist
List packages matching a pattern or criteriaquery
Interrogate installed database and indexespolicy
Show repository policy for packagesversion
Compare package versions or check for available upgradesfetch
Download packages from repositories to the current directorystats
Show statistics about the package database-U, --update-cache
Update package lists before the operation (alias for --cache-max-age 0)-v, --verbose
Print more verbose information (repeat for more detail)-q, --quiet
Print less information-d, --description
Search in package descriptions--no-cache
Do not use or update any local cache; fetch the index directly--allow-untrusted
Install packages with untrusted or missing signatures-X, --repository url
Specify a supplemental repository-p, --root dir
Manage a filesystem rooted at the given directory
CONFIGURATION
/etc/apk/repositories
List of package repository URLs, one per line./etc/apk/world
List of explicitly installed packages and version constraints./etc/apk/keys/
Directory containing trusted repository signing keys.
INSTALL
sudo dnf install apk-tools
sudo pacman -S apk-tools
sudo apk add apk-tools
sudo zypper install apk-tools
nix profile install nixpkgs#apk-tools
CAVEATS
Alpine Linux specific; not available on other distributions. Uses a minimal package format designed for size and simplicity.
HISTORY
Developed for Alpine Linux, a security-oriented, lightweight Linux distribution. Alpine is widely used in container environments due to its small footprint.
