summaryrefslogtreecommitdiff
path: root/pkg/spec/storage.go
diff options
context:
space:
mode:
authorQi Wang <qiwan@redhat.com>2019-07-09 21:46:06 -0400
committerQi Wang <qiwan@redhat.com>2019-07-10 10:26:57 -0400
commitf50f91079a784d2c09f5ac8a3a74dc9b380c94d3 (patch)
treec47ae10aca087b5935f06a6d2331bf3806d675b2 /pkg/spec/storage.go
parent81e722d08617ee19235bf57de6d86124e6b4574a (diff)
downloadpodman-f50f91079a784d2c09f5ac8a3a74dc9b380c94d3.tar.gz
podman-f50f91079a784d2c09f5ac8a3a74dc9b380c94d3.tar.bz2
podman-f50f91079a784d2c09f5ac8a3a74dc9b380c94d3.zip
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 <qiwan@redhat.com>
Diffstat (limited to 'pkg/spec/storage.go')
-rw-r--r--pkg/spec/storage.go7
1 files changed, 7 insertions, 0 deletions
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))