Source:
<code>private MesosCluster(String clusterId) { this.clusterId = clusterId; this.clusterConfig = new ClusterConfig(); List<Container> dockerContainers = DockerClientFactory.get().listContainersCmd().exec(); Collections.sort(dockerContainers, (c1, c2) -> Long.compare(c1.getCreated(), c2.getCreated())); ZooKeeper zookeeper = null; for (Container container : dockerContainers) { String name = ContainerName.getFromDockerNames(container.getNames()); if (ContainerName.belongsToCluster(name, clusterId)) { String containerId = container.getId(); String[] parts = name.split("-"); String role = parts[1]; String uuid = parts[3]; switch (role) { case "zookeeper": zookeeper = new ZooKeeper(this, uuid, containerId); this.containers.add(zookeeper); break; case "agent": this.containers.add(new MesosAgent(this, uuid, containerId)); break; case "master": MesosMaster master = new MesosMaster(this, uuid, containerId); this.containers.add(master); Container.Port[] ports = container.getPorts(); if (ports != null) { for (Container.Port port : ports) { if (port.getIp() != null && port.getPrivatePort() == MesosMasterConfig.MESOS_MASTER_PORT) { setExposedHostPorts(true); } } } break; case "marathon": this.containers.add(new Marathon(this, uuid, containerId)); break; case "consul": <START> this.containers.add(new Consul(DockerClientFactory.get(), this, uuid, containerId)); <END> break; case "registrator": this.containers.add(new Registrator(DockerClientFactory.get(), this, uuid, containerId)); break; } } } if (containers.isEmpty()) { throw new MinimesosException("No containers found for cluster ID " + clusterId); } if (zookeeper != null) { for (MesosAgent mesosAgent : getAgents()) { mesosAgent.setZooKeeperContainer(zookeeper); } getMasterContainer().setZooKeeperContainer(zookeeper); getMarathonContainer().setZooKeeper(zookeeper); } running = true; }</code><technical_language>Consul docker client a parameter</technical_language>

Target:
private MesosCluster(String clusterId) { this.clusterId = clusterId; this.clusterConfig = new ClusterConfig(); List<Container> dockerContainers = DockerClientFactory.build().listContainersCmd().exec(); Collections.sort(dockerContainers, (c1, c2) -> Long.compare(c1.getCreated(), c2.getCreated())); ZooKeeper zookeeper = null; for (Container container : dockerContainers) { String name = ContainerName.getFromDockerNames(container.getNames()); if (ContainerName.belongsToCluster(name, clusterId)) { String containerId = container.getId(); String[] parts = name.split("-"); String role = parts[1]; String uuid = parts[3]; switch (role) { case "zookeeper": zookeeper = new ZooKeeper(this, uuid, containerId); this.containers.add(zookeeper); break; case "agent": this.containers.add(new MesosAgent(this, uuid, containerId)); break; case "master": MesosMaster master = new MesosMaster(this, uuid, containerId); this.containers.add(master); Container.Port[] ports = container.getPorts(); if (ports != null) { for (Container.Port port : ports) { if (port.getIp() != null && port.getPrivatePort() == MesosMasterConfig.MESOS_MASTER_PORT) { setExposedHostPorts(true); } } } break; case "marathon": this.containers.add(new Marathon(this, uuid, containerId)); break; case "consul": this.containers.add(new Consul(this, uuid, containerId)); break; case "registrator": this.containers.add(new Registrator(this, uuid, containerId)); break; } } } if (containers.isEmpty()) { throw new MinimesosException("No containers found for cluster ID " + clusterId); } if (zookeeper != null) { for (MesosAgent mesosAgent : getAgents()) { mesosAgent.setZooKeeperContainer(zookeeper); } getMasterContainer().setZooKeeperContainer(zookeeper); getMarathonContainer().setZooKeeper(zookeeper); } running = true; }