Linux

Where Does Alpine Linux Store Repos and Package Cache?

Alpine keeps repository lists in /etc/apk/repositories, the world package list in /etc/apk/world, and downloaded packages in the apk cache at /etc/apk/cache.

Last updated

Alpine is tiny on purpose and its package paths reflect that. Repository mirrors live in /etc/apk/repositories, explicitly installed packages are listed in /etc/apk/world, and downloads cache in /etc/apk/cache. Three small text friendly locations cover nearly all apk questions.

The cache path surprises people because it sits under /etc rather than /var. On RAM based installs it never touches disk at all. The world file is the interesting one for system recovery: it lists everything you asked for, so reinstalling from it rebuilds the system.

Where Alpine Linux stores this, by platform

Linux
/etc/apk/repositories

Mirror list, one repo per line. Edit to switch mirrors or enable community and testing. Run apk update after changing it.

Linux
/etc/apk/world

Every explicitly installed package, managed by apk add and del. Back this file up to reproduce the system elsewhere. Dependencies resolve from it automatically.

Linux
/etc/apk/cache

Downloaded .apk files, often a symlink to /var/cache/apk. Clear with apk cache clean. On RAM installs this lives in memory by design.

Frequently asked questions

How do I change mirrors on Alpine?

Edit /etc/apk/repositories to add or change mirrors, then run apk update to resync. Community and testing repos are commented out by default. Uncomment what you need rather than adding duplicate lines.

Why is the apk cache using RAM?

Yes, and that is normal. The cache defaults to /etc/apk/cache which may be a symlink to /var/cache/apk, and on diskless or RAM installs it stays in memory. Run apk cache clean to drop it. Packages reinstall from repos on demand.

Notice an outdated path? Let us know.