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
This commit is contained in:
ChristopherHX 2023-12-16 23:46:17 +01:00 committed by GitHub
parent 9cecf94039
commit 1b10028447
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 4 deletions

View File

@ -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)