public static DockerRestClient forDockerClient(DockerClient client) { DockerRestClient x = new DockerRestClient(); x.webTarget = SwarmScanner.extractWebTarget(client); return x; }
public void scan() { WebTarget wt = SwarmScanner.extractWebTarget(getDockerClient()); JsonNode n = wt.path("/info").request().buildGet().invoke(JsonNode.class); if (n.path("Swarm").path("Cluster").isContainerNode()) { logger.info("talking to a docker swarm manager: {}",wt); SwarmScanner ss = new SwarmScanner(this); ss.scan(); } else { // looks like we are talking to a docker engine. We don't support this yet because we need to figure out // how to ensure that we do not get duplicate entries from the Swarm view of the nodes and the engine's view of itself. logger.info("talking to a docker engine: {}",wt); String engineId = n.get("ID").asText(); JsonLogger.logInfo("x", n); updateEngineInfo(n); } }
public void scan() { WebTarget t = extractWebTarget(dockerScanner.getDockerClient()); logger.info("Scanning {}", t); JsonNode response = t.path("/info").request().buildGet().invoke(JsonNode.class);