From f50f91079a784d2c09f5ac8a3a74dc9b380c94d3 Mon Sep 17 00:00:00 2001 From: Qi Wang Date: Tue, 9 Jul 2019 21:46:06 -0400 Subject: fix bug convert volume host path to absolute fix #3504 If --volume host:dest host is not a named volume, convert the host to a absolute directory path. Signed-off-by: Qi Wang --- pkg/spec/storage.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/spec/storage.go b/pkg/spec/storage.go index ed767f5ba..88f1f6dc1 100644 --- a/pkg/spec/storage.go +++ b/pkg/spec/storage.go @@ -211,6 +211,13 @@ func (config *CreateConfig) parseVolumes(runtime *libpod.Runtime) ([]spec.Mount, } mount.Options = opts } + if mount.Type == TypeBind { + absSrc, err := filepath.Abs(mount.Source) + if err != nil { + return nil, nil, errors.Wrapf(err, "error getting absolute path of %s", mount.Source) + } + mount.Source = absSrc + } finalMounts = append(finalMounts, mount) } finalVolumes := make([]*libpod.ContainerNamedVolume, 0, len(baseVolumes)) -- cgit v1.2.3-54-g00ecf