OCImendby CloudTrace

How to fix CVEs in Alpine container images

Short answer

Alpine images are small, so their CVEs are few and almost always fixed by apk upgrade on a supported release branch. Upgrade packages in your image, move to a supported Alpine release when yours reaches its end of support, and keep the image small so there is little to patch.

Fix a Alpine image now → free, no sign-up; pre-filled with alpine:3.20, change it to yours

The steps

  1. 01apk upgradeApplies the fixes published for your release branch.
  2. 02Stay on a supported branchOld branches stop receiving fixes: move to a newer release.
  3. 03Install with --no-cacheNo package index left behind in the image.
  4. 04Pin by digestDeploy exactly what you scanned.

By hand

FROM alpine:3.20
RUN apk upgrade --no-cache
RUN apk add --no-cache ca-certificates

Then rescan: the CVEs that remain are either without a released fix or in code the application never loads (the report marks both).

Traps that bring CVEs back

Alpine images in OCImend's reports

ImageGradeKnown CVEs
alpine:3.20B0Fix
alpine:3.20B0Fix

Questions

How do I fix CVEs in a Alpine container image?
Alpine images are small, so their CVEs are few and almost always fixed by apk upgrade on a supported release branch. Upgrade packages in your image, move to a supported Alpine release when yours reaches its end of support, and keep the image small so there is little to patch.
How long is an Alpine release supported?
Alpine supports each stable branch for about two years; check the release page for your branch.
Does apk upgrade change behaviour?
Within a branch it applies fixes, not new major versions.

Other image types

Python · Node.js · Java · Go · nginx · PostgreSQL · Debian · Ubuntu · Red Hat UBI

Fix a Alpine image now →