in containers-marathon/src/main/java/org/apache/aries/containers/marathon/impl/ContainerImpl.java [41:58]
public ContainerImpl(Marathon marathon, String appID, String taskID, String host,
Collection<Integer> ports, Service service) {
this.marathonClient = marathon;
this.appID = appID;
this.taskID = taskID;
this.host = host;
this.service = service;
// Marathon only reports the external ports which are in the same order as the
// port definitions, so we need to associate them
Map<Integer, Integer> pm = new HashMap<>();
List<Integer> hostPorts = new ArrayList<>(ports);
List<Integer> containerPorts = service.getConfiguration().getContainerPorts();
for (int i=0; i < hostPorts.size() && i < containerPorts.size(); i++) {
pm.put(containerPorts.get(i), hostPorts.get(i));
}
this.ports = Collections.unmodifiableMap(pm);
}