Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit 9f11b15

Browse files
committed
[ISSUE-495] this will allow a service to create more than one alias
Signed-off-by: GodFather <[email protected]>
1 parent 57bd716 commit 9f11b15

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

docker/service/service.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,20 @@ func (s *Service) NetworkConnect(ctx context.Context, c *container.Container, ne
411411
aliases = []string{s.Name()}
412412
}
413413
aliases = append(aliases, net.Aliases...)
414+
if len(net.Aliases) >= 1 {
415+
logrus.Infof("connect")
416+
client.NetworkConnect(ctx, net.RealName, containerID, &network.EndpointSettings{
417+
Aliases: aliases,
418+
Links: links,
419+
IPAddress: net.IPv4Address,
420+
IPAMConfig: &network.EndpointIPAMConfig{
421+
IPv4Address: net.IPv4Address,
422+
IPv6Address: net.IPv6Address,
423+
},
424+
})
425+
logrus.Infof("disconnect")
426+
client.NetworkDisconnect(ctx, net.RealName, containerID, true)
427+
}
414428
return client.NetworkConnect(ctx, net.RealName, containerID, &network.EndpointSettings{
415429
Aliases: aliases,
416430
Links: links,

0 commit comments

Comments
 (0)