summaryrefslogtreecommitdiff
path: root/libpod/container_validate.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-07-20 14:11:17 -0400
committerGitHub <noreply@github.com>2020-07-20 14:11:17 -0400
commit0d26a573e3cf8cc5baea84206a86cb83b433b6d5 (patch)
treefc86e361ff0fd566310262399fec67f94da6514a /libpod/container_validate.go
parente8de509be5b6ff65088a204a5bb5fd32987f561d (diff)
parent020d81f113ea1e11398ea77495cc4b8e05a91d38 (diff)
downloadpodman-0d26a573e3cf8cc5baea84206a86cb83b433b6d5.tar.gz
podman-0d26a573e3cf8cc5baea84206a86cb83b433b6d5.tar.bz2
podman-0d26a573e3cf8cc5baea84206a86cb83b433b6d5.zip
Merge pull request #6895 from QiWang19/pr-3457
Add support for overlay volume mounts in podman.
Diffstat (limited to 'libpod/container_validate.go')
-rw-r--r--libpod/container_validate.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/libpod/container_validate.go b/libpod/container_validate.go
index c02833359..666ad0aca 100644
--- a/libpod/container_validate.go
+++ b/libpod/container_validate.go
@@ -99,5 +99,24 @@ func (c *Container) validate() error {
return errors.Wrapf(define.ErrInvalidArg, "cannot add to /etc/hosts if using image's /etc/hosts")
}
+ // Check named volume and overlay volumes destination conflits
+ destinations := make(map[string]bool)
+ for _, vol := range c.config.NamedVolumes {
+ // Don't check if they already exist.
+ // If they don't we will automatically create them.
+ if _, ok := destinations[vol.Dest]; ok {
+ return errors.Wrapf(define.ErrInvalidArg, "two volumes found with destination %s", vol.Dest)
+ }
+ destinations[vol.Dest] = true
+ }
+ for _, vol := range c.config.OverlayVolumes {
+ // Don't check if they already exist.
+ // If they don't we will automatically create them.
+ if _, ok := destinations[vol.Dest]; ok {
+ return errors.Wrapf(define.ErrInvalidArg, "two volumes found with destination %s", vol.Dest)
+ }
+ destinations[vol.Dest] = true
+ }
+
return nil
}