Fix named network in compose file

Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
Daniel Nephin
2018-03-12 13:09:59 -04:00
parent ca88e5e9df
commit b4c108a385
6 changed files with 60 additions and 11 deletions

View File

@ -39,7 +39,7 @@ func deployBundle(ctx context.Context, dockerCli command.Cli, opts options.Deplo
networks := make(map[string]types.NetworkCreate)
for _, service := range bundle.Services {
for _, networkName := range service.Networks {
networks[networkName] = types.NetworkCreate{
networks[namespace.Scope(networkName)] = types.NetworkCreate{
Labels: convert.AddStackLabel(namespace, nil),
}
}

View File

@ -181,8 +181,7 @@ func createNetworks(
existingNetworkMap[network.Name] = network
}
for internalName, createOpts := range networks {
name := namespace.Scope(internalName)
for name, createOpts := range networks {
if _, exists := existingNetworkMap[name]; exists {
continue
}
@ -193,7 +192,7 @@ func createNetworks(
fmt.Fprintf(dockerCli.Out(), "Creating network %s\n", name)
if _, err := client.NetworkCreate(ctx, name, createOpts); err != nil {
return errors.Wrapf(err, "failed to create network %s", internalName)
return errors.Wrapf(err, "failed to create network %s", name)
}
}
return nil