With the introduction of node-local network support, docker services can
be attached to special networks such as host and bridge. This fix brings in the required changes to make sure the stack file accepts these networks as well. Signed-off-by: Madhu Venugopal <madhu@docker.com>
This commit is contained in:
@ -214,18 +214,21 @@ func convertServiceNetworks(
|
||||
if !ok && networkName != defaultNetwork {
|
||||
return nil, errors.Errorf("undefined network %q", networkName)
|
||||
}
|
||||
var aliases []string
|
||||
if network != nil {
|
||||
aliases = network.Aliases
|
||||
}
|
||||
target := namespace.Scope(networkName)
|
||||
if networkConfig.External.External {
|
||||
target = networkConfig.External.Name
|
||||
}
|
||||
nets = append(nets, swarm.NetworkAttachmentConfig{
|
||||
Target: target,
|
||||
Aliases: append(aliases, name),
|
||||
})
|
||||
netAttachConfig := swarm.NetworkAttachmentConfig{
|
||||
Target: target,
|
||||
}
|
||||
if container.NetworkMode(target).IsUserDefined() {
|
||||
var aliases []string
|
||||
if network != nil {
|
||||
aliases = network.Aliases
|
||||
}
|
||||
netAttachConfig.Aliases = append(aliases, name)
|
||||
}
|
||||
nets = append(nets, netAttachConfig)
|
||||
}
|
||||
|
||||
sort.Sort(byNetworkTarget(nets))
|
||||
|
||||
Reference in New Issue
Block a user