Enhance apk add command to support --no-network as an alternative to --no-cache#295
Open
DanieleIsoni wants to merge 1 commit into
Conversation
…n alternative to --no-cache
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-cacheis not useful, and is actually counterproductive, when combined with--no-network.Here's why:
--no-cachetells 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-networktells 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-networkmeans "only use the local cache", while--no-cachemeans "don't use the local cache". The result is apk has no valid source for packages and the install will fail.