Skip to content
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ All notable changes to this project will be documented in this file.
- Upgraded base image to alpine:3.2 and go 1.4
- bridge.New returns an error instead of calling log.Fatal
- bridge.New will not attempt to ping an adapter.
- Specifying a SERVICE_NAME for containers exposing multiple ports will now result in a named service per port. #194

## [v6] - 2015-08-07
### Fixed
Expand Down
8 changes: 4 additions & 4 deletions bridge/bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,7 @@ func (b *Bridge) add(containerId string, quiet bool) {
func (b *Bridge) newService(port ServicePort, isgroup bool) *Service {
container := port.container
defaultName := strings.Split(path.Base(container.Config.Image), ":")[0]
if isgroup {
defaultName = defaultName + "-" + port.ExposedPort
}


// not sure about this logic. kind of want to remove it.
hostname, err := os.Hostname()
if err != nil {
Expand Down Expand Up @@ -209,6 +206,9 @@ func (b *Bridge) newService(port ServicePort, isgroup bool) *Service {
service.Origin = port
service.ID = hostname + ":" + container.Name[1:] + ":" + port.ExposedPort
service.Name = mapDefault(metadata, "name", defaultName)
if isgroup {
service.Name += "-" + port.ExposedPort
}
var p int
if b.config.Internal == true {
service.IP = port.ExposedIP
Expand Down
4 changes: 3 additions & 1 deletion docs/user/services.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ internal exposed port to differentiate from each other. For example, an image
`nginx-80` and `nginx-443`.

You can override this default name with label or environment variable
`SERVICE_NAME` or `SERVICE_x_NAME`, where `x` is the internal exposed port.
`SERVICE_NAME` or `SERVICE_x_NAME`, where `x` is the internal exposed port. Note
that if a container has multiple exposed ports then setting `SERVICE_NAME` will
still result in multiple services named `SERVICE_NAME-<exposed port>`.

## IP and Port

Expand Down