func retriveHealthCheckPort(service *bridge.Service) int { if portMappings := service.PortMappings(); len(portMappings) > 0 { if checkPort, ok := service.Attrs["check_port"]; ok { if p, err := strconv.Atoi(checkPort); err == nil { if port, ok := portMappings[p]; ok { return port } } } } return service.Port }