Skip to content

Commit 961972d

Browse files
committed
pkg/compose: defaultNetworkSettings: return early for unsupported feature
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent 142ccb6 commit 961972d

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

pkg/compose/create.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,14 @@ func defaultNetworkSettings(project *types.Project,
528528
return "none", nil, nil
529529
}
530530

531+
if versions.LessThan(version, APIVersion149) {
532+
for _, config := range service.Networks {
533+
if config != nil && config.InterfaceName != "" {
534+
return "", nil, fmt.Errorf("interface_name requires Docker Engine %s or later", DockerEngineV28_1)
535+
}
536+
}
537+
}
538+
531539
var primaryNetworkKey string
532540
if len(service.Networks) > 0 {
533541
primaryNetworkKey = service.NetworksByPriority()[0]
@@ -564,14 +572,6 @@ func defaultNetworkSettings(project *types.Project,
564572
}
565573
}
566574

567-
if versions.LessThan(version, APIVersion149) {
568-
for _, config := range service.Networks {
569-
if config != nil && config.InterfaceName != "" {
570-
return "", nil, fmt.Errorf("interface_name requires Docker Engine %s or later", DockerEngineV28_1)
571-
}
572-
}
573-
}
574-
575575
endpointsConfig[primaryNetworkMobyNetworkName] = primaryNetworkEndpoint
576576
networkConfig := &network.NetworkingConfig{
577577
EndpointsConfig: endpointsConfig,

0 commit comments

Comments
 (0)