[20.10 backport] daemon.WithCommonOptions() fix detection of user-namespaces#43084
Merged
tianon merged 1 commit intomoby:20.10from Jan 8, 2022
Merged
[20.10 backport] daemon.WithCommonOptions() fix detection of user-namespaces#43084tianon merged 1 commit intomoby:20.10from
tianon merged 1 commit intomoby:20.10from
Conversation
Commit dae652e added support for non-privileged containers to use ICMP_PROTO (used for `ping`). This option cannot be set for containers that have user-namespaces enabled. However, the detection looks to be incorrect; HostConfig.UsernsMode was added in 6993e89 / ee21838, and the property only has meaning if the daemon is running with user namespaces enabled. In other situations, the property has no meaning. As a result of the above, the sysctl would only be set for containers running with UsernsMode=host on a daemon running with user-namespaces enabled. This patch adds a check if the daemon has user-namespaces enabled (RemappedRoot having a non-empty value), or if the daemon is running inside a user namespace (e.g. rootless mode) to fix the detection. Signed-off-by: Sebastiaan van Stijn <[email protected]> (cherry picked from commit a826ca3) --- The cherry-pick was almost clean but `userns.RunningInUserNS()` -> `sys.RunningInUserNS()`. Fix docker/buildx issue 561 --- Signed-off-by: Akihiro Suda <[email protected]>
tianon
approved these changes
Jan 8, 2022
3 tasks
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.
Cherry-pick #42736
The cherry-pick was almost clean but
userns.RunningInUserNS()->sys.RunningInUserNS().Fix docker/buildx#561