mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-19 23:11:25 +02:00
fix selecting wrong port on remote docker provide
This commit is contained in:
@@ -61,7 +61,7 @@ func (p *Provider) getContainerProxyConfigs(container *types.Container, clientIP
|
||||
}
|
||||
}
|
||||
if config.Port == "" {
|
||||
config.Port = fmt.Sprintf("%d", selectPort(container))
|
||||
config.Port = fmt.Sprintf("%d", selectPort(container, isRemote))
|
||||
}
|
||||
if config.Port == "0" {
|
||||
l.Infof("no ports exposed, ignored")
|
||||
@@ -196,8 +196,8 @@ func getImageName(c *types.Container) string {
|
||||
func getPublicPort(p types.Port) uint16 { return p.PublicPort }
|
||||
func getPrivatePort(p types.Port) uint16 { return p.PrivatePort }
|
||||
|
||||
func selectPort(c *types.Container) uint16 {
|
||||
if c.HostConfig.NetworkMode == "host" {
|
||||
func selectPort(c *types.Container, isRemote bool) uint16 {
|
||||
if isRemote || c.HostConfig.NetworkMode == "host" {
|
||||
return selectPortInternal(c, getPublicPort)
|
||||
}
|
||||
return selectPortInternal(c, getPrivatePort)
|
||||
|
||||
Reference in New Issue
Block a user