resolvePorts method

Future<void> resolvePorts()

Resolves the host ports chosen by Docker (host port 0) from the running container. A reused container takes all its published ports.

Implementation

Future<void> resolvePorts() async {
  var mappings =
      await DockerCMD.getContainerPortMappings(dockerHost, containerName);
  if (mappings == null || mappings.isEmpty) return;

  _ports =
      DockerRunOptions.applyPortMappings(isReused ? null : _ports, mappings);
}