@@ -20,7 +20,6 @@ import (
2020 "context"
2121 "fmt"
2222 "path/filepath"
23- "strings"
2423
2524 "github.com/compose-spec/compose-go/v2/consts"
2625 "github.com/compose-spec/compose-go/v2/override"
@@ -106,11 +105,6 @@ func applyServiceExtends(ctx context.Context, name string, services map[string]a
106105 }
107106 source := deepClone (base ).(map [string ]any )
108107
109- err = validateExtendSource (source , ref )
110- if err != nil {
111- return nil , err
112- }
113-
114108 for _ , processor := range post {
115109 processor .Apply (map [string ]any {
116110 "services" : map [string ]any {
@@ -127,30 +121,6 @@ func applyServiceExtends(ctx context.Context, name string, services map[string]a
127121 return merged , nil
128122}
129123
130- // validateExtendSource check the source for `extends` doesn't refer to another container/service
131- func validateExtendSource (source map [string ]any , ref string ) error {
132- forbidden := []string {"links" , "volumes_from" , "depends_on" }
133- for _ , key := range forbidden {
134- if _ , ok := source [key ]; ok {
135- return fmt .Errorf ("service %q can't be used with `extends` as it declare `%s`" , ref , key )
136- }
137- }
138-
139- sharedNamespace := []string {"network_mode" , "ipc" , "pid" , "net" , "cgroup" , "userns_mode" , "uts" }
140- for _ , key := range sharedNamespace {
141- if v , ok := source [key ]; ok {
142- val := v .(string )
143- if strings .HasPrefix (val , types .ContainerPrefix ) {
144- return fmt .Errorf ("service %q can't be used with `extends` as it shares `%s` with another container" , ref , key )
145- }
146- if strings .HasPrefix (val , types .ServicePrefix ) {
147- return fmt .Errorf ("service %q can't be used with `extends` as it shares `%s` with another service" , ref , key )
148- }
149- }
150- }
151- return nil
152- }
153-
154124func getExtendsBaseFromFile (ctx context.Context , name string , path string , opts * Options , ct * cycleTracker ) (map [string ]any , error ) {
155125 for _ , loader := range opts .ResourceLoaders {
156126 if ! loader .Accept (path ) {
0 commit comments