Skip to content

Commit efdab22

Browse files
author
Adam Burnett
committed
fix where providing a SERVICE_NAME for a container with multiple ports exposed would cause services to overwrite each other
1 parent 84cc01f commit efdab22

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

bridge/bridge.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,7 @@ func (b *Bridge) add(containerId string, quiet bool) {
176176
func (b *Bridge) newService(port ServicePort, isgroup bool) *Service {
177177
container := port.container
178178
defaultName := strings.Split(path.Base(container.Config.Image), ":")[0]
179-
if isgroup {
180-
defaultName = defaultName + "-" + port.ExposedPort
181-
}
182-
179+
183180
// not sure about this logic. kind of want to remove it.
184181
hostname, err := os.Hostname()
185182
if err != nil {
@@ -208,6 +205,9 @@ func (b *Bridge) newService(port ServicePort, isgroup bool) *Service {
208205
service.Origin = port
209206
service.ID = hostname + ":" + container.Name[1:] + ":" + port.ExposedPort
210207
service.Name = mapDefault(metadata, "name", defaultName)
208+
if isgroup {
209+
service.Name += "-" + port.ExposedPort
210+
}
211211
var p int
212212
if b.config.Internal == true {
213213
service.IP = port.ExposedIP

0 commit comments

Comments
 (0)