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

@DanieleIsoni DanieleIsoni commented May 14, 2026

Copy link
Copy Markdown

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.

@tomoyamachi tomoyamachi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution!

It looks like the commit is not GPG-signed, which is required for merging in this repository. Could you please sign your commit? Once it's signed, I'll be happy to merge it.
https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits

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.

2 participants