From 7a253785905711dd6b8f3f80c1aa3fa84c1e4d94 Mon Sep 17 00:00:00 2001 From: "guillaume.tardif" Date: Mon, 24 May 2021 21:49:57 +0200 Subject: [PATCH] Do not resolve mount linux abs path as windows path on windows (eg. /var/run/docker.sock => c:/var/run/docker.sock folder) Signed-off-by: guillaume.tardif --- local/compose/create.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/local/compose/create.go b/local/compose/create.go index acf6b5569..ccf92818e 100644 --- a/local/compose/create.go +++ b/local/compose/create.go @@ -774,7 +774,9 @@ func isUnixAbs(path string) bool { func buildMount(project types.Project, volume types.ServiceVolumeConfig) (mount.Mount, error) { source := volume.Source - if volume.Type == types.VolumeTypeBind && !filepath.IsAbs(source) { + // on windows, filepath.IsAbs(source) is false for unix style abs path like /var/run/docker.sock. + // do not replace these with filepath.Abs(source) that will include a default drive. + if volume.Type == types.VolumeTypeBind && !filepath.IsAbs(source) && !strings.HasPrefix(source, "/") { // volume source has already been prefixed with workdir if required, by compose-go project loader var err error source, err = filepath.Abs(source)