diff --git a/loader/loader.go b/loader/loader.go index 2fbbf50b..27666223 100644 --- a/loader/loader.go +++ b/loader/loader.go @@ -556,7 +556,7 @@ func loadServiceWithExtends(filename, name string, servicesDict map[string]inter if vol.Type != types.VolumeTypeBind { continue } - baseService.Volumes[i].Source = absPath(baseFileParent, vol.Source) + baseService.Volumes[i].Source = resolveMaybeUnixPath(vol.Source, baseFileParent, lookupEnv) } } diff --git a/loader/loader_test.go b/loader/loader_test.go index f51c0e8a..8b57e3ed 100644 --- a/loader/loader_test.go +++ b/loader/loader_test.go @@ -1834,6 +1834,12 @@ func TestLoadWithExtends(t *testing.T) { }, Environment: types.MappingWithEquals{}, Networks: map[string]*types.ServiceNetworkConfig{"default": nil}, + Volumes: []types.ServiceVolumeConfig{{ + Type: "bind", + Source: "/opt/data", + Target: "/var/lib/mysql", + Bind: &types.ServiceVolumeBind{CreateHostPath: true}, + }}, Scale: 1, }, } diff --git a/loader/testdata/compose-test-extends-imported.yaml b/loader/testdata/compose-test-extends-imported.yaml index 03f2ea20..c38f39f1 100644 --- a/loader/testdata/compose-test-extends-imported.yaml +++ b/loader/testdata/compose-test-extends-imported.yaml @@ -1,3 +1,5 @@ services: imported: image: nginx + volumes: + - /opt/data:/var/lib/mysql