getDriver().configureSecurityGroups();
Maybe<SshMachineLocation> found = Machines.findUniqueSshMachineLocation(getLocations());
String dockerLocationSpec = String.format("jclouds:docker:http://%s:%s",
found.get().getSshHostAndPort().getHostText(), getDockerPort());
JcloudsLocation jcloudsLocation = (JcloudsLocation) getManagementContext().getLocationRegistry()
.resolve(dockerLocationSpec, MutableMap.of("identity", "docker", "credential", "docker", ComputeServiceProperties.IMAGE_LOGIN_USER, "root:" + getPassword()));
setAttribute(JCLOUDS_DOCKER_LOCATION, jcloudsLocation);
DockerPortForwarder portForwarder = new DockerPortForwarder(new PortForwardManagerAuthority(this));
portForwarder.init(URI.create(jcloudsLocation.getEndpoint()));
SubnetTier subnetTier = addChild(EntitySpec.create(SubnetTier.class, SubnetTierImpl.class)
.configure(SubnetTier.PORT_FORWARDER, portForwarder)
.configure(SubnetTier.SUBNET_CIDR, Cidr.UNIVERSAL));
Entities.manage(subnetTier);
subnetTier.start(ImmutableList.of(found.get()));