Endpoint returns external (from host perspective) service endpoint (host:port) for given port name. External means that it will be accessible only from host, but not from docker containers. If your service is not running, this method returns incorrect `stopped` endpoint.
(portName string)
| 510 | // |
| 511 | // If your service is not running, this method returns incorrect `stopped` endpoint. |
| 512 | func (d *dockerRunnable) Endpoint(portName string) string { |
| 513 | if !d.IsRunning() { |
| 514 | return "stopped" |
| 515 | } |
| 516 | |
| 517 | // Map the container port to the local port. |
| 518 | localPort, ok := d.hostPorts[portName] |
| 519 | if !ok { |
| 520 | return "" |
| 521 | } |
| 522 | |
| 523 | // Do not use "localhost", because it doesn't work with the AWS DynamoDB client. |
| 524 | return fmt.Sprintf("127.0.0.1:%d", localPort) |
| 525 | } |
| 526 | |
| 527 | // InternalEndpoint returns internal service endpoint (host:port) for given internal port. |
| 528 | // Internal means that it will be accessible only from docker containers within the network that this |