diff options
author | Giuseppe Scrivano <gscrivan@redhat.com> | 2021-11-15 15:01:55 +0100 |
---|---|---|
committer | Giuseppe Scrivano <gscrivan@redhat.com> | 2021-11-18 17:01:06 +0100 |
commit | e83d366651e9c68e2802924d7c7d3ac69ca3eb14 (patch) | |
tree | 3e9cd076be9acab193e0b6d6d8114dc2facb22db /pkg | |
parent | 9b964945d661d4f97b4a97f2f67d33f9dcd11e50 (diff) | |
download | podman-e83d366651e9c68e2802924d7c7d3ac69ca3eb14.tar.gz podman-e83d366651e9c68e2802924d7c7d3ac69ca3eb14.tar.bz2 podman-e83d366651e9c68e2802924d7c7d3ac69ca3eb14.zip |
volumes: add new option idmap
pass down the "idmap" mount option to the OCI runtime.
Needs: https://github.com/containers/crun/pull/780
Closes: https://github.com/containers/podman/issues/12154
[NO NEW TESTS NEEDED] there is no crun version yet that support the
new feature.
Test case (must run as root):
podman run --rm -v foo:/foo alpine touch /foo/bar
podman run --uidmap 0:1:1000 --rm -v foo:/foo:idmap alpine ls -l /foo
total 0
-rw-r--r-- 1 root root 0 Nov 15 14:01 bar
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/specgenutil/volumes.go | 2 | ||||
-rw-r--r-- | pkg/util/mountOpts.go | 1 |
2 files changed, 3 insertions, 0 deletions
diff --git a/pkg/specgenutil/volumes.go b/pkg/specgenutil/volumes.go index 184bfadf8..8ff770f9c 100644 --- a/pkg/specgenutil/volumes.go +++ b/pkg/specgenutil/volumes.go @@ -355,6 +355,8 @@ func getBindMount(args []string) (spec.Mount, error) { newMount.Options = append(newMount.Options, "U") } setOwnership = true + case "idmap": + 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. diff --git a/pkg/util/mountOpts.go b/pkg/util/mountOpts.go index f13dc94ec..959763dba 100644 --- a/pkg/util/mountOpts.go +++ b/pkg/util/mountOpts.go @@ -33,6 +33,7 @@ func ProcessOptions(options []string, isTmpfs bool, sourcePath string) ([]string // Some options have parameters - size, mode splitOpt := strings.SplitN(opt, "=", 2) switch splitOpt[0] { + case "idmap": case "O": if len(options) > 1 { return nil, errors.Wrapf(ErrDupeMntOption, "'O' option can not be used with other options") |