Skip inspect of builtin networks on service create

Signed-off-by: Trapier Marshall <trapier.marshall@docker.com>
This commit is contained in:
Trapier Marshall 2019-08-16 15:51:31 -04:00
parent d88565df0c
commit e193234f14
1 changed files with 10 additions and 3 deletions

View File

@ -613,9 +613,16 @@ func (options *serviceOptions) ToService(ctx context.Context, apiClient client.N
networks := convertNetworks(options.networks) networks := convertNetworks(options.networks)
for i, net := range networks { for i, net := range networks {
nwID, err := resolveNetworkID(ctx, apiClient, net.Target) var nwID string
if err != nil { if !container.NetworkMode(net.Target).IsUserDefined() {
return service, err // Networks that are not user defined always exist on all nodes as
// local-scoped networks, so there's no need to inspect them.
nwID = net.Target
} else {
nwID, err = resolveNetworkID(ctx, apiClient, net.Target)
if err != nil {
return service, err
}
} }
networks[i].Target = nwID networks[i].Target = nwID
} }