Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkg: support passing down options for idmap #13228

Merged
merged 1 commit into from
Feb 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion pkg/specgenutil/volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,11 @@ func getBindMount(args []string) (spec.Mount, error) {
}
setOwnership = true
case "idmap":
newMount.Options = append(newMount.Options, "idmap")
if len(kv) > 1 {
newMount.Options = append(newMount.Options, fmt.Sprintf("idmap=%s", kv[1]))
} else {
newMount.Options = append(newMount.Options, "idmap")
}
case "consistency":
// Often used on MACs and mistakenly on Linux platforms.
// Since Docker ignores this option so shall we.
Expand Down
12 changes: 8 additions & 4 deletions pkg/util/mountOpts.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,18 @@ func ProcessOptions(options []string, isTmpfs bool, sourcePath string) ([]string
}
}

switch splitOpt[0] {
case "O":
foundOverlay = true
case "idmap":
if strings.HasPrefix(splitOpt[0], "idmap") {
if foundIdmap {
return nil, errors.Wrapf(ErrDupeMntOption, "the 'idmap' option can only be set once")
}
foundIdmap = true
newOptions = append(newOptions, opt)
continue
}

switch splitOpt[0] {
case "O":
foundOverlay = true
case "exec", "noexec":
if foundExec {
return nil, errors.Wrapf(ErrDupeMntOption, "only one of 'noexec' and 'exec' can be used")
Expand Down