apk module manages packages on Alpine Linux systems using the apk package manager.
Functions
packages
Install, remove, or update apk packages.str | list[str]
List of packages to ensure.
bool
default:true
Whether the packages should be installed.
bool
default:false
Whether to upgrade packages without a specified version.
bool
default:false
Run
apk update before installing packages.bool
default:false
Run
apk upgrade before installing packages.Package versions can be pinned like apk:
<pkg>=<version>Examples
update
Update apk package indexes.upgrade
Upgrade all apk packages.bool
default:false
Force all packages to be upgraded (recommended on whole Alpine version upgrades).
Common Use Cases
Basic System Setup
Container Base Image Setup
Development Environment
Python Development
System Upgrade
Alpine-Specific Tips
Virtual Packages
Virtual Packages
Alpine supports virtual packages for build dependencies that can be easily removed:
Edge Repository
Edge Repository
For latest packages, you may need to use the edge repository:
No Cache Option
No Cache Option
For minimal container images, use —no-cache:
