From a97b4132794c1441e7b7556fc3cb19266e582f4c Mon Sep 17 00:00:00 2001 From: Tomas Kral Date: Thu, 21 Jul 2016 17:52:48 +0200 Subject: [PATCH] use empytDir rather then hostPath On remote cluster or in cloud it can be tricky to get hostPath working as expected by compose --- cli/app/app.go | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/cli/app/app.go b/cli/app/app.go index d7b553b18..fca4b4036 100644 --- a/cli/app/app.go +++ b/cli/app/app.go @@ -453,8 +453,6 @@ func configVolumes(service ServiceConfig) ([]api.VolumeMount, []api.Volume) { for _, volume := range service.Volumes { character := ":" if strings.Contains(volume, character) { - hostDir := volume[0:strings.Index(volume, character)] - hostDir = strings.TrimSpace(hostDir) containerDir := volume[strings.Index(volume, character)+1:] containerDir = strings.TrimSpace(containerDir) @@ -472,11 +470,10 @@ func configVolumes(service ServiceConfig) ([]api.VolumeMount, []api.Volume) { volumeName := RandStringBytes(20) volumesMount = append(volumesMount, api.VolumeMount{Name: volumeName, ReadOnly: readonly, MountPath: containerDir}) - p := &api.HostPathVolumeSource{ - Path: hostDir, - } - //p.Path = hostDir - volumeSource := api.VolumeSource{HostPath: p} + + emptyDir := &api.EmptyDirVolumeSource{} + volumeSource := api.VolumeSource{EmptyDir: emptyDir} + volumes = append(volumes, api.Volume{Name: volumeName, VolumeSource: volumeSource}) } }