Skip to content

Commit 1b10028

Browse files
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
1 parent 9cecf94 commit 1b10028

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

pkg/container/docker_run.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -448,8 +448,8 @@ func (cr *containerReference) create(capAdd []string, capDrop []string) common.E
448448
var networkingConfig *network.NetworkingConfig
449449
logger.Debugf("input.NetworkAliases ==> %v", input.NetworkAliases)
450450
n := hostConfig.NetworkMode
451-
// TODO: use IsUserDefined() once it's windows implementation matches the unix one
452-
if !n.IsDefault() && !n.IsBridge() && !n.IsHost() && !n.IsNone() && !n.IsContainer() && len(input.NetworkAliases) > 0 {
451+
// IsUserDefined and IsHost are broken on windows
452+
if n.IsUserDefined() && n != "host" && len(input.NetworkAliases) > 0 {
453453
endpointConfig := &network.EndpointSettings{
454454
Aliases: input.NetworkAliases,
455455
}
@@ -458,8 +458,6 @@ func (cr *containerReference) create(capAdd []string, capDrop []string) common.E
458458
input.NetworkMode: endpointConfig,
459459
},
460460
}
461-
} else {
462-
logger.Debugf("not a use defined config??")
463461
}
464462

465463
resp, err := cr.cli.ContainerCreate(ctx, config, hostConfig, networkingConfig, platSpecs, input.Name)

0 commit comments

Comments
 (0)