public String getIpAddressForService(String serviceName, String network) {
    Map networks = composeContainer.getContainerByServiceName(serviceName + "_1").get()
        .getCurrentContainerInfo().getNetworkSettings().getNetworks();
    for (Object object : networks.entrySet()) {
      String key = (String) ((Map.Entry<?, ?>) object).getKey();
      if (key.contains(network)) {
        ContainerNetwork containerNetwork =
            (ContainerNetwork) ((Map.Entry<?, ?>) object).getValue();
        return containerNetwork.getIpAddress();
      }
    }
    return null;
  }
Get the ip address for a service using a compose network.

@param serviceName the service
@param network the network used by the service
@return the ip address
geode-assembly/src/acceptanceTest/java/org/apache/geode/rules/DockerComposeRule.java