code: func PortBindingFromDockerPortBinding(dockerPortBindings nat.PortMap) ([]PortBinding, apierrors.NamedError) {
  	portBindings := make([]PortBinding, 0, len(dockerPortBindings))
  
  	for port, bindings := range dockerPortBindings {
  		containerPort, err := nat.ParsePort(port.Port())
  		if err != nil {
  			return nil, &apierrors.DefaultNamedError{Name: UnparseablePortErrorName, Err: "Error parsing docker port as int " + err.Error()}
  		}
  		protocol, err := NewTransportProtocol(port.Proto())
  		if err != nil {
  			return nil, &apierrors.DefaultNamedError{Name: UnrecognizedTransportProtocolErrorName, Err: err.Error()}
  		}
  
  		for _, binding := range bindings {
  			hostPort, err := strconv.Atoi(binding.HostPort)
  			if err != nil {
  				return nil, &apierrors.DefaultNamedError{Name: UnparseablePortErrorName, Err: "Error parsing port binding as int " + err.Error()}
  			}
  			portBindings = append(portBindings, PortBinding{
  				ContainerPort: uint16(containerPort),
  				HostPort:      uint16(hostPort),
  				BindIP:        binding.HostIP,
  				Protocol:      protocol,
  			})
  		}
  	}
  	return portBindings, nil
  }
docs: // PortBindingFromDockerPortBinding constructs a PortBinding slice from a docker
  // NetworkSettings.Ports map.