diff --git a/compose/convert/service.go b/compose/convert/service.go index 37f3ece403..a245987c8f 100644 --- a/compose/convert/service.go +++ b/compose/convert/service.go @@ -301,9 +301,11 @@ func convertEndpointSpec(source []string) (*swarm.EndpointSpec, error) { } for port := range ports { - portConfigs = append( - portConfigs, - opts.ConvertPortToPortConfig(port, portBindings)...) + portConfig, err := opts.ConvertPortToPortConfig(port, portBindings) + if err != nil { + return nil, err + } + portConfigs = append(portConfigs, portConfig...) } return &swarm.EndpointSpec{Ports: portConfigs}, nil