diff options
Diffstat (limited to 'pkg/spec/spec.go')
-rw-r--r-- | pkg/spec/spec.go | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/pkg/spec/spec.go b/pkg/spec/spec.go index 12b3b42b5..77dbf8b42 100644 --- a/pkg/spec/spec.go +++ b/pkg/spec/spec.go @@ -2,6 +2,7 @@ package createconfig import ( "os" + "path" "strings" "github.com/containers/libpod/libpod" @@ -310,18 +311,21 @@ func CreateConfigToOCISpec(config *CreateConfig) (*spec.Spec, error) { //nolint if err != nil { return nil, errors.Wrapf(err, "error getting volume mounts") } - // If we have overlappings mounts, remove them from the spec in favor of - // the user-added volume mounts - destinations := make(map[string]bool) - for _, mount := range mounts { - destinations[mount.Destination] = true - } - for _, mount := range configSpec.Mounts { - if _, ok := destinations[mount.Destination]; !ok { - mounts = append(mounts, mount) + if len(mounts) > 0 { + // If we have overlappings mounts, remove them from the spec in favor of + // the user-added volume mounts + destinations := make(map[string]bool) + for _, mount := range mounts { + destinations[path.Clean(mount.Destination)] = true + } + for _, mount := range configSpec.Mounts { + if _, ok := destinations[path.Clean(mount.Destination)]; !ok { + logrus.Debugf("Adding mount %s", mount.Destination) + mounts = append(mounts, mount) + } } + configSpec.Mounts = mounts } - configSpec.Mounts = mounts if err := g.SetLinuxRootPropagation("shared"); err != nil { return nil, errors.Wrapf(err, "failed to set propagation to rslave") |