From 1b1002844772c5107f16321bd26ccfe7f6f0b48b Mon Sep 17 00:00:00 2001 From: ChristopherHX Date: Sat, 16 Dec 2023 23:46:17 +0100 Subject: [PATCH] fix: IsHost is defined as false on windows (#2093) * fix: IsHost is defined as false on windows * Update docker_run.go * Update docker_run.go --- pkg/container/docker_run.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pkg/container/docker_run.go b/pkg/container/docker_run.go index 5a8afa22..18328845 100644 --- a/pkg/container/docker_run.go +++ b/pkg/container/docker_run.go @@ -448,8 +448,8 @@ func (cr *containerReference) create(capAdd []string, capDrop []string) common.E var networkingConfig *network.NetworkingConfig logger.Debugf("input.NetworkAliases ==> %v", input.NetworkAliases) n := hostConfig.NetworkMode - // TODO: use IsUserDefined() once it's windows implementation matches the unix one - if !n.IsDefault() && !n.IsBridge() && !n.IsHost() && !n.IsNone() && !n.IsContainer() && len(input.NetworkAliases) > 0 { + // IsUserDefined and IsHost are broken on windows + if n.IsUserDefined() && n != "host" && len(input.NetworkAliases) > 0 { endpointConfig := &network.EndpointSettings{ Aliases: input.NetworkAliases, } @@ -458,8 +458,6 @@ func (cr *containerReference) create(capAdd []string, capDrop []string) common.E input.NetworkMode: endpointConfig, }, } - } else { - logger.Debugf("not a use defined config??") } resp, err := cr.cli.ContainerCreate(ctx, config, hostConfig, networkingConfig, platSpecs, input.Name)