Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
15 changes: 11 additions & 4 deletions bridge/bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down Expand Up @@ -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
Expand All @@ -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")
Expand Down
15 changes: 8 additions & 7 deletions bridge/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down