mirror of
https://github.com/yusing/godoxy.git
synced 2025-06-09 04:52:35 +02:00
fix port discovery for docker
This commit is contained in:
parent
110bb362b3
commit
1fd7b50010
2 changed files with 4 additions and 2 deletions
BIN
bin/go-proxy
BIN
bin/go-proxy
Binary file not shown.
|
@ -46,7 +46,9 @@ func (p *Provider) getContainerProxyConfigs(container types.Container, clientIP
|
||||||
if config.Port == "" && clientIP != "" {
|
if config.Port == "" && clientIP != "" {
|
||||||
for _, port := range container.Ports {
|
for _, port := range container.Ports {
|
||||||
config.Port = fmt.Sprintf("%d", port.PublicPort)
|
config.Port = fmt.Sprintf("%d", port.PublicPort)
|
||||||
break
|
if config.Port != "0" {
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if config.Port == "" {
|
} else if config.Port == "" {
|
||||||
// usually the smaller port is the http one
|
// usually the smaller port is the http one
|
||||||
|
@ -63,7 +65,7 @@ func (p *Provider) getContainerProxyConfigs(container types.Container, clientIP
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if config.Port == "" {
|
if config.Port == "" || config.Port == "0" {
|
||||||
// no ports exposed or specified
|
// no ports exposed or specified
|
||||||
p.Logf("Build", "no ports exposed for %s, ignored", container_name)
|
p.Logf("Build", "no ports exposed for %s, ignored", container_name)
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Add table
Reference in a new issue