Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Commit ba58827

Browse files
committed
configure service with ipAddress
Signed-off-by: Nicolas De Loof <[email protected]>
1 parent 2c79e63 commit ba58827

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

local/compose/convergence.go

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -328,17 +328,28 @@ func (s *composeService) createMobyContainer(ctx context.Context, project *types
328328
aliases = append(aliases, cfg.Aliases...)
329329
}
330330
}
331-
err = s.connectContainerToNetwork(ctx, created.ID, netwrk.Name, aliases...)
331+
332+
err = s.connectContainerToNetwork(ctx, created.ID, netwrk.Name, cfg, aliases...)
332333
if err != nil {
333334
return err
334335
}
335336
}
336337
return nil
337338
}
338339

339-
func (s *composeService) connectContainerToNetwork(ctx context.Context, id string, netwrk string, aliases ...string) error {
340+
func (s *composeService) connectContainerToNetwork(ctx context.Context, id string, netwrk string, cfg *types.ServiceNetworkConfig, aliases ...string) error {
341+
var (
342+
ipv4ddress string
343+
ipv6Address string
344+
)
345+
if cfg != nil {
346+
ipv4ddress = cfg.Ipv4Address
347+
ipv6Address = cfg.Ipv6Address
348+
}
340349
err := s.apiClient.NetworkConnect(ctx, netwrk, id, &network.EndpointSettings{
341-
Aliases: aliases,
350+
Aliases: aliases,
351+
IPAddress: ipv4ddress,
352+
GlobalIPv6Address: ipv6Address,
342353
})
343354
if err != nil {
344355
return err

0 commit comments

Comments
 (0)