Skip to content

Enhance apk add command to support --no-network as an alternative to --no-cache#295

Open
DanieleIsoni wants to merge 1 commit into
goodwithtech:masterfrom
DanieleIsoni:make-no-network-to-be-an-alternative-for-no-cache-in-apk-add
Open

Enhance apk add command to support --no-network as an alternative to --no-cache#295
DanieleIsoni wants to merge 1 commit into
goodwithtech:masterfrom
DanieleIsoni:make-no-network-to-be-an-alternative-for-no-cache-in-apk-add

Conversation

@DanieleIsoni
Copy link
Copy Markdown

@DanieleIsoni DanieleIsoni commented May 14, 2026

Improve the handling of the apk add command by allowing --no-network as an alternative option to --no-cache, ensuring more flexible command usage.

--no-cache is not useful, and is actually counterproductive, when combined with --no-network.

Here's why:

  • --no-cache tells apk to skip the local cache directory (/var/cache/apk/). Its purpose is to avoid storing downloaded packages in the image layer, keeping Docker images small. It only makes sense when packages are being fetched from the network.
  • --no-network tells apk not to access the network at all, so it can only install packages from what's already locally available (i.e., the local cache).

Together, they conflict: --no-network means "only use the local cache", while --no-cache means "don't use the local cache". The result is apk has no valid source for packages and the install will fail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant