mirror of https://github.com/docker/cli.git
Skip inspect of builtin networks on service create
Signed-off-by: Trapier Marshall <trapier.marshall@docker.com>
This commit is contained in:
parent
d88565df0c
commit
e193234f14
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue