summaryrefslogtreecommitdiff
path: root/pkg/domain/infra
diff options
context:
space:
mode:
authorPaul Holzinger <pholzing@redhat.com>2021-06-10 13:52:30 +0200
committerPaul Holzinger <pholzing@redhat.com>2021-06-11 13:27:08 +0200
commitad3b56c62f07bbbd97433e972db0a0582dd84840 (patch)
treec2fd8733a19e085949c2bae83423c7622638834d /pkg/domain/infra
parentea39735845655aaf77de577a35557a0fb003514f (diff)
downloadpodman-ad3b56c62f07bbbd97433e972db0a0582dd84840.tar.gz
podman-ad3b56c62f07bbbd97433e972db0a0582dd84840.tar.bz2
podman-ad3b56c62f07bbbd97433e972db0a0582dd84840.zip
Fix volumes with uid and gid options
Podman uses the volume option map to check if it has to mount the volume or not when the container is started. Commit 28138dafcc39 added to uid and gid options to this map, however when only uid/gid is set we cannot mount this volume because there is no filesystem or device specified. Make sure we do not try to mount the volume when only the uid/gid option is set since this is a simple chown operation. Also when a uid/gid is explicity set, do not chown the volume based on the container user when the volume is used for the first time. Fixes #10620 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to 'pkg/domain/infra')
-rw-r--r--pkg/domain/infra/abi/parse/parse.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/pkg/domain/infra/abi/parse/parse.go b/pkg/domain/infra/abi/parse/parse.go
index 1c590d2d6..56c747711 100644
--- a/pkg/domain/infra/abi/parse/parse.go
+++ b/pkg/domain/infra/abi/parse/parse.go
@@ -37,7 +37,7 @@ func VolumeOptions(opts map[string]string) ([]libpod.VolumeCreateOption, error)
return nil, errors.Wrapf(err, "cannot convert UID %s to integer", splitO[1])
}
logrus.Debugf("Removing uid= from options and adding WithVolumeUID for UID %d", intUID)
- libpodOptions = append(libpodOptions, libpod.WithVolumeUID(intUID))
+ libpodOptions = append(libpodOptions, libpod.WithVolumeUID(intUID), libpod.WithVolumeNoChown())
finalVal = append(finalVal, o)
// set option "UID": "$uid"
volumeOptions["UID"] = splitO[1]
@@ -50,7 +50,7 @@ func VolumeOptions(opts map[string]string) ([]libpod.VolumeCreateOption, error)
return nil, errors.Wrapf(err, "cannot convert GID %s to integer", splitO[1])
}
logrus.Debugf("Removing gid= from options and adding WithVolumeGID for GID %d", intGID)
- libpodOptions = append(libpodOptions, libpod.WithVolumeGID(intGID))
+ libpodOptions = append(libpodOptions, libpod.WithVolumeGID(intGID), libpod.WithVolumeNoChown())
finalVal = append(finalVal, o)
// set option "GID": "$gid"
volumeOptions["GID"] = splitO[1]