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; }
@Test public void inspectContainerNetworkSettings() throws DockerException { CreateContainerResponse container = dockerClient.createContainerCmd("busybox").withCmd("env").exec(); LOG.info("Created container {}", container.toString()); assertThat(container.getId(), not(isEmptyString())); InspectContainerResponse inspectContainerResponse = dockerClient.inspectContainerCmd(container.getId()).exec(); assertFalse(inspectContainerResponse.getNetworkSettings().getHairpinMode()); }