mappedPort method

  1. @override
int mappedPort(
  1. int port
)
override

The port on host that the container's port is published on; the port must be listed in withExposedPorts, and the container started.

Implementation

@override
int mappedPort(int port) {
  final state = _state;
  if (state == null) {
    throw StateError(
      'The container of $image is not started: call start() before '
      'mappedPort',
    );
  }
  return state.mappedPort(port) ??
      (throw StateError(
        'Port $port of $image is not published: add it with '
        'withExposedPorts([$port]) '
        '(published: ${state.ports.keys.join(', ')})',
      ));
}