code: public Map<String, PortMapping> ports() {
      final ImmutableMap.Builder<String, PortMapping> builder = ImmutableMap.builder();
      for (final Map.Entry<String, PortMapping> e : job.getPorts().entrySet()) {
        final PortMapping mapping = e.getValue();
        builder.put(e.getKey(), mapping.hasExternalPort()
                                ? mapping
                                : mapping.withExternalPort(checkNotNull(ports.get(e.getKey()))));
      }
      return builder.build();
    }
docs: Get final port mappings using allocated ports.
  
  @return The port mapping.