Skip to content

Commit

Permalink
fix: IsHost is defined as false on windows (#2093)
Browse files Browse the repository at this point in the history
* fix: IsHost is defined as false on windows

* Update docker_run.go

* Update docker_run.go
  • Loading branch information
ChristopherHX committed Dec 16, 2023
1 parent 9cecf94 commit 1b10028
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions pkg/container/docker_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand All @@ -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)
Expand Down

0 comments on commit 1b10028

Please sign in to comment.