diff --git a/Makefile b/Makefile index 8ff9c57e9..eeb925cff 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ release: rm -rf release && mkdir release go get github.com/progrium/gh-release/... cp build/* release - gh-release create gliderlabs/$(NAME) $(VERSION) \ + gh-release create orcinustools/$(NAME) $(VERSION) \ $(shell git rev-parse --abbrev-ref HEAD) $(VERSION) docs: diff --git a/bridge/bridge.go b/bridge/bridge.go index f02ca99c9..5f6b1dea4 100644 --- a/bridge/bridge.go +++ b/bridge/bridge.go @@ -202,7 +202,7 @@ func (b *Bridge) add(containerId string, quiet bool) { // Extract configured host port mappings, relevant when using --net=host for port, _ := range container.Config.ExposedPorts { - published := []dockerapi.PortBinding{ {"0.0.0.0", port.Port()}, } + published := []dockerapi.PortBinding{{"0.0.0.0", port.Port()}} ports[string(port)] = servicePort(container, port, published) } @@ -290,8 +290,15 @@ func (b *Bridge) newService(port ServicePort, isgroup bool) *Service { } var p int - if b.config.Internal == true { - service.IP = port.ExposedIP + service.Network = strings.ToLower(mapDefault(metadata, "network", container.HostConfig.NetworkMode)) + if b.config.Internal == true && service.Network != "host" { + log.Printf("service %s will use network %s", service.Name, service.Network) + network, exists := container.NetworkSettings.Networks[service.Network] + if !exists { + service.IP = port.ExposedIP + } else { + service.IP = network.IPAddress + } p, _ = strconv.Atoi(port.ExposedPort) } else { service.IP = port.HostIP @@ -309,7 +316,7 @@ func (b *Bridge) newService(port ServicePort, isgroup bool) *Service { service.IP = containerIp } log.Println("using container IP " + service.IP + " from label '" + - b.config.UseIpFromLabel + "'") + b.config.UseIpFromLabel + "'") } else { log.Println("Label '" + b.config.UseIpFromLabel + "' not found in container configuration") diff --git a/bridge/types.go b/bridge/types.go index e643ed3f5..bb8743d72 100644 --- a/bridge/types.go +++ b/bridge/types.go @@ -32,13 +32,14 @@ type Config struct { } type Service struct { - ID string - Name string - Port int - IP string - Tags []string - Attrs map[string]string - TTL int + ID string + Name string + Port int + IP string + Tags []string + Attrs map[string]string + TTL int + Network string Origin ServicePort }