Skip to content
Latchkey

apk update: Usage, Options & Common CI Errors

apk update refreshes Alpine's local package index from the repositories.

apk update downloads the latest Alpine package indexes. In modern Dockerfiles it is largely superseded by apk add --no-cache, but it is still needed when you run multiple apk add steps or pin versions.

What it does

apk update fetches the APKINDEX from each configured repository in /etc/apk/repositories and stores it under /var/cache/apk. apk add then installs from that index. If you use --no-cache on every add, you never need a separate apk update.

Common usage

Terminal
apk update && apk add curl git
apk update                                      # refresh the index only
apk add --no-cache curl                         # no apk update needed
echo 'https://dl-cdn.alpinelinux.org/alpine/v3.20/community' >> /etc/apk/repositories
apk update

Common errors in CI

"WARNING: Ignoring ... UNTRUSTED signature" or "temporary error (try again later)" usually means a mirror/network blip - retry, or pin a reliable CDN mirror. "fetch ... returned 404" indicates the repository URL points at an Alpine version that no longer exists (e.g. an EOL v3.x branch); update /etc/apk/repositories to a supported release. If a later apk add says the package is missing right after update, the package is in the community repo, which may not be enabled in the base image.

Options

ItemWhat it does
updateRefresh the package index
--no-cache (on add)Makes a separate update unnecessary
upgradeUpgrade all installed packages
/etc/apk/repositoriesList of repository URLs to index

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →