Skip to content
Latchkey

apk update and apk upgrade on Alpine

apk update refreshes the Alpine package index from the repositories listed in /etc/apk/repositories.

Most CI installs use apk add --no-cache and never call update explicitly, but when you manage the index by hand, update refreshes it and upgrade applies pending changes.

What it does

apk update downloads the latest index for each repository in /etc/apk/repositories. apk upgrade then installs newer versions of already-installed packages. With --no-cache on apk add, update happens implicitly for that command.

Common usage

Terminal
apk update
apk upgrade
# add a repository line, then refresh
echo "https://dl-cdn.alpinelinux.org/alpine/edge/community" \
  >> /etc/apk/repositories
apk update

Options

CommandWhat it does
apk updateRefresh the package index
apk upgradeUpgrade installed packages to newer versions
apk upgrade --availableForce re-eval against the current index
apk upgrade --no-cacheUpgrade without caching the index
/etc/apk/repositoriesThe list of repository URLs

In CI

Prefer apk add --no-cache for single installs so you skip a separate update. When mixing edge/community repos, add the repo line before apk update or the new packages will not be visible.

Common errors in CI

"WARNING: Ignoring https://... : No such file or directory" or "temporary error (try again later)" means a repository mirror is down or unreachable; retry or pick another CDN. "fetch ... returned 404" for the index means the pinned Alpine version no longer exists on the mirror. A stale index causes apk add to miss recently added packages; run apk update.

Related guides

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