| 827 | } |
| 828 | |
| 829 | func buildContainerPortBindingOptions(s types.ServiceConfig) (network.PortMap, error) { |
| 830 | bindings := network.PortMap{} |
| 831 | for _, port := range s.Ports { |
| 832 | var err error |
| 833 | p, err := network.ParsePort(fmt.Sprintf("%d/%s", port.Target, port.Protocol)) |
| 834 | if err != nil { |
| 835 | return nil, err |
| 836 | } |
| 837 | var hostIP netip.Addr |
| 838 | if port.HostIP != "" { |
| 839 | hostIP, err = netip.ParseAddr(port.HostIP) |
| 840 | if err != nil { |
| 841 | return nil, err |
| 842 | } |
| 843 | } |
| 844 | bindings[p] = append(bindings[p], network.PortBinding{ |
| 845 | HostIP: hostIP, |
| 846 | HostPort: port.Published, |
| 847 | }) |
| 848 | } |
| 849 | return bindings, nil |
| 850 | } |
| 851 | |
| 852 | func getDependentServiceFromMode(mode string) string { |
| 853 | if strings.HasPrefix( |