Пример #1
0
 @Override
 protected Set<Integer> findUsedPortByHostAndDocker() {
   try {
     FabricService fabric = getFabricService();
     Container currentContainer = fabric.getCurrentContainer();
     Set<Integer> usedPorts;
     Set<Integer> dockerPorts;
     synchronized (portLock) {
       usedPorts = fabric.getPortService().findUsedPortByHost(currentContainer);
       dockerPorts = Dockers.getUsedPorts(docker);
     }
     usedPorts.addAll(dockerPorts);
     return usedPorts;
   } catch (DockerApiConnectionException e) {
     String suggestion =
         String.format(
             "Can't connect to the Docker server. Are you sure a Docker server is running at %s?",
             dockerFactory.getAddress());
     throw new DockerApiConnectionException(suggestion, e.getCause());
   }
 }