LOG.info("Image Inspect: {}", imageInspectResponse.toString());
tmpImgs.add(imageInspectResponse.getId());
ContainerConfig containerConfig = new ContainerConfig();
containerConfig.setImage(imageInspectResponse.getId());
ContainerCreateResponse container = dockerClient
.createContainer(containerConfig);
assertThat(container.getId(), not(isEmptyString()));
dockerClient.startContainer(container.getId());
tmpContainers.add(container.getId());
ContainerInspectResponse containerInspectResponse = dockerClient
.inspectContainer(container.getId());
assertThat(containerInspectResponse.getId(), notNullValue());
assertThat(containerInspectResponse.getNetworkSettings().ports,
notNullValue());
// No use as such if not running on the server
for (String portstr : containerInspectResponse.getNetworkSettings().ports
.getAllPorts().keySet()) {
Ports.Port p = containerInspectResponse.getNetworkSettings().ports
.getAllPorts().get(portstr);
int port = Integer.valueOf(p.getHostPort());
LOG.info("Checking port {} is open", port);
assertThat(available(port), is(false));
}
dockerClient.stopContainer(container.getId(), 0);
}