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
apk update
apk upgrade
# add a repository line, then refresh
echo "https://dl-cdn.alpinelinux.org/alpine/edge/community" \
>> /etc/apk/repositories
apk updateOptions
| Command | What it does |
|---|---|
| apk update | Refresh the package index |
| apk upgrade | Upgrade installed packages to newer versions |
| apk upgrade --available | Force re-eval against the current index |
| apk upgrade --no-cache | Upgrade without caching the index |
| /etc/apk/repositories | The 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.