diff options
-rw-r--r-- | libpod/options.go | 4 | ||||
-rw-r--r-- | pkg/specgen/volumes.go | 3 |
2 files changed, 4 insertions, 3 deletions
diff --git a/libpod/options.go b/libpod/options.go index b94ef88ba..89901b094 100644 --- a/libpod/options.go +++ b/libpod/options.go @@ -1456,6 +1456,10 @@ func WithNamedVolumes(volumes []*ContainerNamedVolume) CtrCreateOption { return errors.Wrapf(err, "error processing options for named volume %q mounted at %q", vol.Name, vol.Dest) } + if err = parse.ValidateVolumeCtrDir(vol.Dest); err != nil { + return errors.Wrapf(err, "error validating destination path for named volume %q mounted at %q", vol.Name, vol.Dest) + } + ctr.config.NamedVolumes = append(ctr.config.NamedVolumes, &ContainerNamedVolume{ Name: vol.Name, Dest: vol.Dest, diff --git a/pkg/specgen/volumes.go b/pkg/specgen/volumes.go index d85d2bdd1..6bee43745 100644 --- a/pkg/specgen/volumes.go +++ b/pkg/specgen/volumes.go @@ -93,9 +93,6 @@ func GenVolumeMounts(volumeFlag []string) (map[string]spec.Mount, map[string]*Na return nil, nil, nil, errors.New("host directory cannot be empty") } } - if err := parse.ValidateVolumeCtrDir(dest); err != nil { - return nil, nil, nil, err - } cleanDest := filepath.Clean(dest) |