public Map<String, String> getIPAddresses() {
   Map<String, String> idToIpAddressMap = new HashMap<>();
   for (Id id : ids()) {
     Conf conf = repo.conf(id);
     if (inclusive(id) && conf.isExposeContainerIp()) {
       String containerName = repo.containerName(id);
       InspectContainerResponse containerInspectResponse =
           docker.inspectContainerCmd(containerName).exec();
       idToIpAddressMap.put(
           id.toString(), containerInspectResponse.getNetworkSettings().getIpAddress());
     }
   }
   return idToIpAddressMap;
 }
 private String findImageId(Id id) {
   String imageTag = repo.tag(id);
   logger.debug("Converting {} ({}) to image id.", id, imageTag);
   List<Image> images = docker.listImagesCmd().exec();
   for (Image i : images) {
     for (String tag : i.getRepoTags()) {
       if (tag.startsWith(imageTag)) {
         logger.debug(
             "Using {} ({}) for {}. It matches (enough) to {}.",
             new Object[] {i.getId(), tag, id.toString(), imageTag});
         return i.getId();
       }
     }
   }
   logger.debug("could not find image ID for \"" + id + "\" (tag \"" + imageTag + "\")");
   return null;
 }
  private void healthCheck(Id id) {
    final HealthChecks healthChecks = conf(id).getHealthChecks();
    for (Ping ping : healthChecks.getPings()) {
      URI uri;
      if (ping.getUrl().toString().contains(CONTAINER_IP_PATTERN)) {
        try {
          uri =
              new URI(
                  ping.getUrl()
                      .toString()
                      .replace(CONTAINER_IP_PATTERN, getIPAddresses().get(id.toString())));
        } catch (URISyntaxException e) {
          throw new OrchestrationException(
              "Bad health check URI syntax: "
                  + e.getMessage()
                  + ", input: "
                  + e.getInput()
                  + ", index:"
                  + e.getIndex());
        }
      } else {
        uri = ping.getUrl();
      }
      logger.info(String.format("Pinging %s for pattern \"%s\"", uri, ping.getPattern()));

      if (!Pinger.ping(uri, ping.getPattern(), ping.getTimeout())) {
        throw new OrchestrationException(
            "timeout waiting for "
                + uri
                + " for "
                + ping.getTimeout()
                + " with pattern "
                + ping.getPattern());
      }
    }
  }