stratos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From im...@apache.org
Subject [4/6] git commit: Docker IaaS support initial implementation
Date Thu, 05 Jun 2014 07:01:26 GMT
Docker IaaS support initial implementation


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/d45ad99a
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/d45ad99a
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/d45ad99a

Branch: refs/heads/master
Commit: d45ad99a4ea22ee65c6f657d34806f1d9134b827
Parents: ca7a14a
Author: Imesh Gunaratne <imesh@apache.org>
Authored: Thu Jun 5 09:06:17 2014 +0530
Committer: Imesh Gunaratne <imesh@apache.org>
Committed: Thu Jun 5 09:06:17 2014 +0530

----------------------------------------------------------------------
 .../cloud/controller/iaases/DockerIaas.java     | 152 ++++++
 .../validate/DockerPartitionValidator.java      |  49 ++
 .../jclouds/apis/docker/1.7.1-stratos/README.md |  52 +++
 .../jclouds/apis/docker/1.7.1-stratos/pom.xml   | 145 ++++++
 .../main/java/org/jclouds/docker/DockerApi.java |  38 ++
 .../org/jclouds/docker/DockerApiMetadata.java   | 100 ++++
 .../binders/BindInputStreamToRequest.java       |  74 +++
 .../DockerComputeServiceContextModule.java      |  73 +++
 .../extensions/DockerImageExtension.java        | 120 +++++
 .../docker/compute/features/RemoteApi.java      | 275 +++++++++++
 .../compute/features/internal/Archives.java     |  96 ++++
 .../functions/ContainerToNodeMetadata.java      | 131 ++++++
 .../docker/compute/functions/ImageToImage.java  | 104 +++++
 .../docker/compute/functions/StateToStatus.java |  40 ++
 .../compute/options/DockerTemplateOptions.java  | 365 +++++++++++++++
 .../strategy/DockerComputeServiceAdapter.java   | 223 +++++++++
 .../docker/config/DockerHttpApiModule.java      |  42 ++
 .../docker/config/DockerParserModule.java       | 101 ++++
 .../jclouds/docker/config/DockerProperties.java |  29 ++
 .../java/org/jclouds/docker/domain/Config.java  | 460 +++++++++++++++++++
 .../org/jclouds/docker/domain/Container.java    | 372 +++++++++++++++
 .../org/jclouds/docker/domain/ExposedPorts.java | 105 +++++
 .../org/jclouds/docker/domain/HostConfig.java   | 180 ++++++++
 .../java/org/jclouds/docker/domain/Image.java   | 240 ++++++++++
 .../jclouds/docker/domain/NetworkSettings.java  | 176 +++++++
 .../java/org/jclouds/docker/domain/Port.java    |  91 ++++
 .../java/org/jclouds/docker/domain/State.java   | 169 +++++++
 .../java/org/jclouds/docker/domain/Version.java | 169 +++++++
 .../docker/handlers/DockerErrorHandler.java     | 108 +++++
 .../jclouds/docker/options/BuildOptions.java    |  73 +++
 .../jclouds/docker/options/CommitOptions.java   | 111 +++++
 .../docker/options/CreateImageOptions.java      | 129 ++++++
 .../docker/options/DeleteImageOptions.java      |  46 ++
 .../docker/options/ListContainerOptions.java    |  97 ++++
 .../docker/options/ListImageOptions.java        |  43 ++
 .../docker/options/RemoveContainerOptions.java  |  57 +++
 .../services/org.jclouds.apis.ApiMetadata       |   1 +
 .../src/main/resources/centos/Dockerfile        |  29 ++
 .../src/main/resources/ubuntu/Dockerfile        |  30 ++
 .../jclouds/docker/DockerApiMetadataTest.java   |  49 ++
 .../docker/compute/BaseDockerApiLiveTest.java   |  96 ++++
 .../DockerComputeServiceAdapterLiveTest.java    | 138 ++++++
 .../compute/DockerExperimentLiveTest.java       | 144 ++++++
 .../compute/features/RemoteApiLiveTest.java     | 136 ++++++
 .../compute/features/RemoteApiMockTest.java     | 358 +++++++++++++++
 .../functions/ContainerToNodeMetadataTest.java  | 162 +++++++
 .../compute/functions/ImageToImageTest.java     |  75 +++
 .../compute/functions/StateToStatusTest.java    |  83 ++++
 .../docker/config/DockerParserModuleTest.java   | 102 ++++
 .../docker/internal/BaseDockerMockTest.java     | 119 +++++
 .../1.7.1-stratos/src/test/resources/Dockerfile |  29 ++
 .../src/test/resources/container-creation.json  |   1 +
 .../src/test/resources/container.json           |  87 ++++
 .../src/test/resources/containers.json          |  20 +
 .../src/test/resources/logback.xml              |  34 ++
 dependencies/pom.xml                            |   1 +
 .../pom.xml                                     |  13 +-
 .../main/resources/conf/cloud-controller.xml    |  10 +-
 .../distribution/src/main/conf/autoscaler.xml   |   6 +-
 .../src/main/conf/cartridge-config.properties   |   4 +-
 60 files changed, 6554 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/d45ad99a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/DockerIaas.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/DockerIaas.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/DockerIaas.java
new file mode 100644
index 0000000..742aed2
--- /dev/null
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/DockerIaas.java
@@ -0,0 +1,152 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.stratos.cloud.controller.iaases;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.cloud.controller.exception.CloudControllerException;
+import org.apache.stratos.cloud.controller.exception.InvalidHostException;
+import org.apache.stratos.cloud.controller.exception.InvalidRegionException;
+import org.apache.stratos.cloud.controller.exception.InvalidZoneException;
+import org.apache.stratos.cloud.controller.interfaces.Iaas;
+import org.apache.stratos.cloud.controller.jcloud.ComputeServiceBuilderUtil;
+import org.apache.stratos.cloud.controller.pojo.IaasProvider;
+import org.apache.stratos.cloud.controller.validate.DockerPartitionValidator;
+import org.apache.stratos.cloud.controller.validate.interfaces.PartitionValidator;
+import org.jclouds.compute.ComputeService;
+import org.jclouds.compute.domain.Image;
+import org.jclouds.compute.domain.NodeMetadata;
+import org.jclouds.compute.domain.Template;
+
+import java.util.Set;
+
+/**
+ * Docker iaas provider definition.
+ */
+public class DockerIaas extends Iaas {
+
+    private static final Log log = LogFactory.getLog(AWSEC2Iaas.class);
+
+    public DockerIaas(IaasProvider iaasProvider) {
+        super(iaasProvider);
+    }
+
+    @Override
+    public void buildComputeServiceAndTemplate() {
+        // builds and sets Compute Service
+        ComputeServiceBuilderUtil.buildDefaultComputeService(getIaasProvider());
+
+        // builds and sets Template
+        buildTemplate();
+    }
+
+    @Override
+    public void setDynamicPayload() {
+        log.warn("Not implemented: DockerIaas.setDynamicPayload()");
+    }
+
+    @Override
+    public String associateAddress(NodeMetadata node) {
+        log.warn("Not implemented: DockerIaas.associateAddress()");
+        return null;
+    }
+
+    @Override
+    public String associatePredefinedAddress(NodeMetadata node, String ip) {
+        log.warn("Not implemented: DockerIaas.associatePredefinedAddress()");
+        return null;
+    }
+
+    @Override
+    public void releaseAddress(String ip) {
+        log.warn("Not implemented: DockerIaas.releaseAddress()");
+    }
+
+    @Override
+    public boolean createKeyPairFromPublicKey(String region, String keyPairName, String publicKey) {
+        return false;
+    }
+
+    @Override
+    public boolean isValidRegion(String region) throws InvalidRegionException {
+        return true;
+    }
+
+    @Override
+    public boolean isValidZone(String region, String zone) throws InvalidZoneException {
+        return true;
+    }
+
+    @Override
+    public boolean isValidHost(String zone, String host) throws InvalidHostException {
+        return true;
+    }
+
+    @Override
+    public PartitionValidator getPartitionValidator() {
+        return new DockerPartitionValidator();
+    }
+
+    @Override
+    public void buildTemplate() {
+        IaasProvider iaasProvider = getIaasProvider();
+        ComputeService computeService = iaasProvider.getComputeService();
+        Set<? extends Image> images = computeService.listImages();
+        Image image = findImage(images, iaasProvider.getImage());
+        if(image == null) {
+            throw new CloudControllerException(String.format("Docker image not found: %s", iaasProvider.getImage()));
+        }
+        Template template = computeService.templateBuilder().fromImage(image).build();
+        iaasProvider.setTemplate(template);
+    }
+
+    private Image findImage(Set<? extends Image> images, String name) {
+        for(Image image : images) {
+            if(image.getDescription().contains(name))
+                return image;
+        }
+        return null;
+    }
+
+    @Override
+    public String createVolume(int sizeGB, String snapshotId) {
+        return null;
+    }
+
+    @Override
+    public String attachVolume(String instanceId, String volumeId, String deviceName) {
+        return null;
+    }
+
+    @Override
+    public void detachVolume(String instanceId, String volumeId) {
+
+    }
+
+    @Override
+    public void deleteVolume(String volumeId) {
+
+    }
+
+    @Override
+    public String getIaasDevice(String device) {
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/d45ad99a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/validate/DockerPartitionValidator.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/validate/DockerPartitionValidator.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/validate/DockerPartitionValidator.java
new file mode 100644
index 0000000..63df9b9
--- /dev/null
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/validate/DockerPartitionValidator.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.stratos.cloud.controller.validate;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.cloud.controller.exception.InvalidPartitionException;
+import org.apache.stratos.cloud.controller.iaases.AWSEC2Iaas;
+import org.apache.stratos.cloud.controller.pojo.IaasProvider;
+import org.apache.stratos.cloud.controller.validate.interfaces.PartitionValidator;
+
+import java.util.Properties;
+
+/**
+ * Docker partition validator definition.
+ */
+public class DockerPartitionValidator implements PartitionValidator {
+    private static final Log log = LogFactory.getLog(AWSEC2Iaas.class);
+
+    private IaasProvider iaasProvider;
+
+    @Override
+    public void setIaasProvider(IaasProvider iaasProvider) {
+        this.iaasProvider = iaasProvider;
+    }
+
+    @Override
+    public IaasProvider validate(String partitionId, Properties properties) throws InvalidPartitionException {
+        log.warn("Not implemented: DockerPartitionValidator.validate()");
+        return iaasProvider;
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/d45ad99a/dependencies/jclouds/apis/docker/1.7.1-stratos/README.md
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/docker/1.7.1-stratos/README.md b/dependencies/jclouds/apis/docker/1.7.1-stratos/README.md
new file mode 100644
index 0000000..3ce8cf0
--- /dev/null
+++ b/dependencies/jclouds/apis/docker/1.7.1-stratos/README.md
@@ -0,0 +1,52 @@
+# Docker as a local cloud provider
+jclouds-docker is a local cloud provider modelled on [docker](http://www.docker.io). Similar to other jclouds supported
+providers, it supports the same portable abstractions offered by jclouds.
+
+##Setup
+
+Please follow these steps to configure your workstation for jclouds-docker:
+
+- install the latest Docker release (please visit http://www.docker.io/gettingstarted/)
+
+If you are on OS X, please consider [boot2docker](http://docs.docker.io/en/latest/installation/mac/) as simplified
+way to install docker locally.
+
+#How it works
+
+
+                                               ---------------   -------------
+                                              |   Image(s)    | |   Node(s)   |
+                                              ---------------   -------------
+     ---------    docker remote api           ----------------------------------------
+    | jclouds | ---------------------------> |              DOCKER_HOST              |
+     ---------                               ----------------------------------------
+
+##Components
+
+- jclouds \- acts as a java client to access to docker features
+- DOCKER_HOST \- hosts Docker API, NB: jclouds-docker assumes that the latest Docker is installed
+- Image \- it is a docker image that can be started.
+- Node \- is a docker container
+
+## Assumptions
+
+- jclouds-docker assumes that the images specified using the template are ssh'able.
+- jclouds-docker will mount ${user.home} to /root of the container
+
+--------------
+
+#Notes:
+- jclouds-docker is still at alpha stage please report any issues you find at [jclouds issues](https://github.com/jclouds/jclouds/issues?state=open)
+- jclouds-docker has been tested on Mac OSX, it might work on Linux iff vbox is running and set up correctly. However, it will not currently run on Windows.
+
+--------------
+
+#Troubleshooting
+As jclouds docker support is quite new, issues may occasionally arise. Please follow these steps to get things going again:
+
+1. Remove all containers
+
+      `$ docker ps -a -q | xargs docker stop | xargs docker rm`
+2. remove all the images
+
+    `$ docker images -q | xargs docker rmi`

http://git-wip-us.apache.org/repos/asf/stratos/blob/d45ad99a/dependencies/jclouds/apis/docker/1.7.1-stratos/pom.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/docker/1.7.1-stratos/pom.xml b/dependencies/jclouds/apis/docker/1.7.1-stratos/pom.xml
new file mode 100644
index 0000000..0fb9b96
--- /dev/null
+++ b/dependencies/jclouds/apis/docker/1.7.1-stratos/pom.xml
@@ -0,0 +1,145 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.jclouds.labs</groupId>
+    <artifactId>jclouds-labs</artifactId>
+    <version>1.7.1</version>
+  </parent>
+
+  <!-- TODO: when out of labs, switch to org.jclouds.provider -->
+  <groupId>org.apache.stratos</groupId>
+  <artifactId>docker</artifactId>
+  <name>jclouds docker API</name>
+  <version>1.7.1-stratos</version>
+  <description>ComputeService binding to the Docker API</description>
+  <packaging>bundle</packaging>
+
+  <properties>
+    <jclouds.version>1.7.1</jclouds.version>
+    <test.docker.endpoint>https://localhost:4243</test.docker.endpoint>
+    <test.docker.api-version>1.10</test.docker.api-version>
+    <test.docker.identity>FIXME</test.docker.identity>
+    <test.docker.credential>FIXME</test.docker.credential>
+    <jclouds.osgi.export>org.jclouds.docker*;version="${project.version}"</jclouds.osgi.export>
+    <jclouds.osgi.import>
+      org.jclouds.compute.internal;version="${jclouds.version}",
+      org.jclouds.rest.internal;version="${jclouds.version}",
+      org.jclouds*;version="${jclouds.version}",
+      *
+    </jclouds.osgi.import>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.jclouds</groupId>
+      <artifactId>jclouds-core</artifactId>
+      <version>${jclouds.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.jclouds</groupId>
+      <artifactId>jclouds-compute</artifactId>
+      <version>${jclouds.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-compress</artifactId>
+      <version>1.5</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.jclouds.driver</groupId>
+      <artifactId>jclouds-sshj</artifactId>
+      <version>${jclouds.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.jclouds</groupId>
+      <artifactId>jclouds-core</artifactId>
+      <version>${jclouds.version}</version>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.jclouds</groupId>
+      <artifactId>jclouds-compute</artifactId>
+      <version>${jclouds.version}</version>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.jclouds.driver</groupId>
+      <artifactId>jclouds-slf4j</artifactId>
+      <version>${jclouds.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>ch.qos.logback</groupId>
+      <artifactId>logback-classic</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>com.squareup.okhttp</groupId>
+      <artifactId>mockwebserver</artifactId>
+      <scope>test</scope>
+      <exclusions>
+        <!-- Already provided by jclouds-sshj -->
+        <exclusion>
+          <groupId>org.bouncycastle</groupId>
+          <artifactId>bcprov-jdk15on</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+  </dependencies>
+
+  <profiles>
+    <profile>
+      <id>live</id>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-surefire-plugin</artifactId>
+            <executions>
+              <execution>
+                <id>integration</id>
+                <phase>integration-test</phase>
+                <goals>
+                  <goal>test</goal>
+                </goals>
+                <configuration>
+                  <systemPropertyVariables>
+                    <test.docker.endpoint>${test.docker.endpoint}</test.docker.endpoint>
+                    <test.docker.api-version>${test.docker.api-version}</test.docker.api-version>
+                    <test.docker.credential>${test.docker.identity}</test.docker.credential>
+                    <test.docker.credential>${test.docker.credential}</test.docker.credential>
+                  </systemPropertyVariables>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+
+</project>

http://git-wip-us.apache.org/repos/asf/stratos/blob/d45ad99a/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/DockerApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/DockerApi.java b/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/DockerApi.java
new file mode 100644
index 0000000..9fe6135
--- /dev/null
+++ b/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/DockerApi.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.docker;
+
+import org.jclouds.docker.compute.features.RemoteApi;
+import org.jclouds.rest.annotations.Delegate;
+
+import java.io.Closeable;
+
+/**
+ * Provides synchronous access to Docker Remote API.
+ *
+ * @author Andrea Turli
+ * @see <a href="http://docs.docker.io/en/latest/api/docker_remote_api_v1.8/#docker-remote-api-v1-8"></a>
+ */
+public interface DockerApi extends Closeable {
+
+   /**
+    * Provides synchronous access to Docker Remote API features.
+    */
+   @Delegate
+   RemoteApi getRemoteApi();
+
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/d45ad99a/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/DockerApiMetadata.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/DockerApiMetadata.java b/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/DockerApiMetadata.java
new file mode 100644
index 0000000..c627d82
--- /dev/null
+++ b/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/DockerApiMetadata.java
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.docker;
+
+import static org.jclouds.compute.config.ComputeServiceProperties.TEMPLATE;
+import static org.jclouds.reflect.Reflection2.typeToken;
+import java.net.URI;
+import java.util.Properties;
+
+import org.jclouds.Constants;
+import org.jclouds.apis.ApiMetadata;
+import org.jclouds.compute.ComputeServiceContext;
+import org.jclouds.compute.config.ComputeServiceProperties;
+import org.jclouds.docker.compute.config.DockerComputeServiceContextModule;
+import org.jclouds.docker.config.DockerHttpApiModule;
+import org.jclouds.docker.config.DockerParserModule;
+import org.jclouds.rest.internal.BaseHttpApiMetadata;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.Module;
+
+/**
+ * Implementation of {@link BaseHttpApiMetadata} for the Docker API
+ *
+ * @author Andrea Turli
+ */
+public class DockerApiMetadata extends BaseHttpApiMetadata<DockerApi> {
+
+   @Override
+   public Builder toBuilder() {
+      return new Builder().fromApiMetadata(this);
+   }
+
+   public DockerApiMetadata() {
+      this(new Builder());
+   }
+
+   protected DockerApiMetadata(Builder builder) {
+      super(builder);
+   }
+
+   public static Properties defaultProperties() {
+      Properties properties = BaseHttpApiMetadata.defaultProperties();
+      properties.setProperty(Constants.PROPERTY_MAX_RETRIES, "15");
+      properties.setProperty("jclouds.ssh.retry-auth", "true");
+      properties.setProperty(Constants.PROPERTY_CONNECTION_TIMEOUT, "1200000"); // 15 minutes
+      properties.setProperty(ComputeServiceProperties.IMAGE_LOGIN_USER, "root:password");
+      properties.setProperty(TEMPLATE, "osFamily=UBUNTU,os64Bit=true,osVersionMatches=1[012].[01][04]");
+      return properties;
+   }
+
+   public static class Builder extends BaseHttpApiMetadata.Builder<DockerApi, Builder> {
+
+      protected Builder() {
+         super(DockerApi.class);
+         id("docker")
+                 .name("Docker API")
+                 .identityName("user")
+                 .credentialName("password")
+                 .documentation(URI.create("http://docs.docker.io/en/latest/api/docker_remote_api/"))
+                 .version("1.10")
+                 .defaultEndpoint("http://127.0.0.1:4243")
+                 .defaultProperties(DockerApiMetadata.defaultProperties())
+                 .view(typeToken(ComputeServiceContext.class))
+                 .defaultModules(ImmutableSet.<Class<? extends Module>>of(
+                         DockerHttpApiModule.class,
+                         DockerParserModule.class,
+                         DockerComputeServiceContextModule.class));
+      }
+
+      @Override
+      public DockerApiMetadata build() {
+         return new DockerApiMetadata(this);
+      }
+
+      @Override
+      protected Builder self() {
+         return this;
+      }
+
+      @Override
+      public Builder fromApiMetadata(ApiMetadata in) {
+         return this;
+      }
+   }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/d45ad99a/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/binders/BindInputStreamToRequest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/binders/BindInputStreamToRequest.java b/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/binders/BindInputStreamToRequest.java
new file mode 100644
index 0000000..ea485d2
--- /dev/null
+++ b/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/binders/BindInputStreamToRequest.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.docker.binders;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+
+import javax.annotation.Resource;
+import javax.inject.Named;
+import javax.inject.Singleton;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.compute.reference.ComputeServiceConstants;
+import org.jclouds.docker.compute.features.internal.Archives;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.io.Payload;
+import org.jclouds.io.Payloads;
+import org.jclouds.logging.Logger;
+import org.jclouds.rest.Binder;
+
+import com.google.common.base.Throwables;
+import com.google.common.io.Files;
+
+/**
+ * @author Andrea Turli
+ */
+@Singleton
+public class BindInputStreamToRequest implements Binder {
+
+   @Resource
+   @Named(ComputeServiceConstants.COMPUTE_LOGGER)
+   protected Logger logger = Logger.NULL;
+
+   @SuppressWarnings("unchecked")
+   @Override
+   public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+      checkArgument(checkNotNull(input, "input") instanceof File, "this binder is only valid for File!");
+      checkNotNull(request, "request");
+
+      File dockerFile = (File) input;
+      File tmpDir = Files.createTempDir();
+      final File targetFile = new File(tmpDir + File.separator + "Dockerfile");
+      try {
+         Files.copy(dockerFile, targetFile);
+         File archive = Archives.tar(tmpDir, File.createTempFile("archive", ".tar"));
+         FileInputStream data = new FileInputStream(archive);
+         Payload payload = Payloads.newInputStreamPayload(data);
+         payload.getContentMetadata().setContentLength(data.getChannel().size());
+         payload.getContentMetadata().setContentType(MediaType.TEXT_PLAIN);
+         request.setPayload(payload);
+      } catch (IOException e) {
+         logger.error(e, "Couldn't create a tarball for %s", targetFile);
+         throw Throwables.propagate(e);
+      }
+      return request;
+   }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/d45ad99a/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/compute/config/DockerComputeServiceContextModule.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/compute/config/DockerComputeServiceContextModule.java b/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/compute/config/DockerComputeServiceContextModule.java
new file mode 100644
index 0000000..7368299
--- /dev/null
+++ b/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/compute/config/DockerComputeServiceContextModule.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.docker.compute.config;
+
+import com.google.common.base.Function;
+import com.google.common.base.Optional;
+import com.google.inject.Injector;
+import com.google.inject.TypeLiteral;
+import org.jclouds.compute.ComputeServiceAdapter;
+import org.jclouds.compute.config.ComputeServiceAdapterContextModule;
+import org.jclouds.compute.domain.Hardware;
+import org.jclouds.compute.domain.NodeMetadata;
+import org.jclouds.compute.extensions.ImageExtension;
+import org.jclouds.compute.options.TemplateOptions;
+import org.jclouds.docker.compute.extensions.DockerImageExtension;
+import org.jclouds.docker.compute.functions.ContainerToNodeMetadata;
+import org.jclouds.docker.compute.functions.ImageToImage;
+import org.jclouds.docker.compute.functions.StateToStatus;
+import org.jclouds.docker.compute.options.DockerTemplateOptions;
+import org.jclouds.docker.compute.strategy.DockerComputeServiceAdapter;
+import org.jclouds.docker.domain.Container;
+import org.jclouds.docker.domain.Image;
+import org.jclouds.docker.domain.State;
+import org.jclouds.domain.Location;
+import org.jclouds.functions.IdentityFunction;
+
+/**
+ * @author Andrea Turli
+ */
+public class DockerComputeServiceContextModule extends
+        ComputeServiceAdapterContextModule<Container, Hardware, Image, Location> {
+
+   @Override
+   protected void configure() {
+      super.configure();
+      bind(new TypeLiteral<ComputeServiceAdapter<Container, Hardware, Image, Location>>() {
+      }).to(DockerComputeServiceAdapter.class);
+      bind(new TypeLiteral<Function<Container, NodeMetadata>>() {
+      }).to(ContainerToNodeMetadata.class);
+      bind(new TypeLiteral<Function<Image, org.jclouds.compute.domain.Image>>() {
+      }).to(ImageToImage.class);
+      bind(new TypeLiteral<Function<Hardware, Hardware>>() {
+      }).to(Class.class.cast(IdentityFunction.class));
+      bind(new TypeLiteral<Function<Location, Location>>() {
+      }).to(Class.class.cast(IdentityFunction.class));
+      bind(new TypeLiteral<Function<State, NodeMetadata.Status>>() {
+      }).to(StateToStatus.class);
+      bind(TemplateOptions.class).to(DockerTemplateOptions.class);
+
+      bind(new TypeLiteral<ImageExtension>() {
+      }).to(DockerImageExtension.class);
+   }
+
+   @Override
+   protected Optional<ImageExtension> provideImageExtension(Injector i) {
+      return Optional.of(i.getInstance(ImageExtension.class));
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/d45ad99a/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/compute/extensions/DockerImageExtension.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/compute/extensions/DockerImageExtension.java b/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/compute/extensions/DockerImageExtension.java
new file mode 100644
index 0000000..8b4820d
--- /dev/null
+++ b/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/compute/extensions/DockerImageExtension.java
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.docker.compute.extensions;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_IMAGE_AVAILABLE;
+import java.util.NoSuchElementException;
+import java.util.concurrent.Callable;
+import java.util.concurrent.atomic.AtomicReference;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.Constants;
+import org.jclouds.compute.domain.CloneImageTemplate;
+import org.jclouds.compute.domain.Image;
+import org.jclouds.compute.domain.ImageTemplate;
+import org.jclouds.compute.domain.ImageTemplateBuilder;
+import org.jclouds.compute.extensions.ImageExtension;
+import org.jclouds.compute.reference.ComputeServiceConstants;
+import org.jclouds.docker.DockerApi;
+import org.jclouds.docker.compute.functions.ImageToImage;
+import org.jclouds.docker.domain.Container;
+import org.jclouds.docker.options.CommitOptions;
+import org.jclouds.logging.Logger;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.ImmutableList;
+import com.google.common.util.concurrent.Atomics;
+import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.ListeningExecutorService;
+import com.google.common.util.concurrent.UncheckedTimeoutException;
+
+/**
+ * Docker implementation of {@link org.jclouds.compute.extensions.ImageExtension}
+ *
+ * @author Andrea Turli
+ */
+@Singleton
+public class DockerImageExtension implements ImageExtension {
+
+   @Resource
+   @Named(ComputeServiceConstants.COMPUTE_LOGGER)
+   private Logger logger = Logger.NULL;
+   private final DockerApi api;
+   private final ListeningExecutorService userExecutor;
+   private final Predicate<AtomicReference<Image>> imageAvailablePredicate;
+
+   @Inject
+   public DockerImageExtension(DockerApi api, @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService
+           userExecutor, @Named(TIMEOUT_IMAGE_AVAILABLE) Predicate<AtomicReference<Image>> imageAvailablePredicate) {
+      this.api = checkNotNull(api, "api");
+      this.userExecutor = checkNotNull(userExecutor, "userExecutor");
+      this.imageAvailablePredicate = checkNotNull(imageAvailablePredicate, "imageAvailablePredicate");
+   }
+
+   @Override
+   public ImageTemplate buildImageTemplateFromNode(String name, final String id) {
+      Container container = api.getRemoteApi().inspectContainer(id);
+      if (container == null)
+         throw new NoSuchElementException("Cannot find container with id: " + id);
+      CloneImageTemplate template = new ImageTemplateBuilder.CloneImageTemplateBuilder().nodeId(id).name(name).build();
+      return template;
+   }
+
+   @Override
+   public ListenableFuture<Image> createImage(ImageTemplate template) {
+      checkArgument(template instanceof CloneImageTemplate,
+              " docker only currently supports creating images through cloning.");
+      CloneImageTemplate cloneTemplate = (CloneImageTemplate) template;
+
+      Container container = api.getRemoteApi().inspectContainer(cloneTemplate.getSourceNodeId());
+      CommitOptions options = CommitOptions.Builder.containerId(container.getId()).tag(cloneTemplate.getName());
+      org.jclouds.docker.domain.Image dockerImage = api.getRemoteApi().commit(options);
+
+      dockerImage = org.jclouds.docker.domain.Image.builder().fromImage(dockerImage)
+              .repoTags(ImmutableList.of(cloneTemplate.getName() + ":latest"))
+              .build();
+
+      logger.info(">> Registered new image %s, waiting for it to become available.", dockerImage.getId());
+      final AtomicReference<Image> image = Atomics.newReference(new ImageToImage().apply(dockerImage));
+      return userExecutor.submit(new Callable<Image>() {
+         @Override
+         public Image call() throws Exception {
+            if (imageAvailablePredicate.apply(image))
+               return image.get();
+            throw new UncheckedTimeoutException("Image was not created within the time limit: " + image.get());
+         }
+      });
+   }
+
+   @Override
+   public boolean deleteImage(String id) {
+      try {
+         api.getRemoteApi().deleteImage(id);
+      } catch (Exception e) {
+         logger.error(e, "Could not delete image with id %s ", id);
+         return false;
+      }
+      return true;
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/d45ad99a/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/compute/features/RemoteApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/compute/features/RemoteApi.java b/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/compute/features/RemoteApi.java
new file mode 100644
index 0000000..bc4abff
--- /dev/null
+++ b/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/compute/features/RemoteApi.java
@@ -0,0 +1,275 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.docker.compute.features;
+
+import java.io.Closeable;
+import java.io.File;
+import java.io.InputStream;
+import java.util.Set;
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.Fallbacks;
+import org.jclouds.docker.binders.BindInputStreamToRequest;
+import org.jclouds.docker.domain.Config;
+import org.jclouds.docker.domain.Container;
+import org.jclouds.docker.domain.HostConfig;
+import org.jclouds.docker.domain.Image;
+import org.jclouds.docker.domain.Version;
+import org.jclouds.docker.options.BuildOptions;
+import org.jclouds.docker.options.CommitOptions;
+import org.jclouds.docker.options.CreateImageOptions;
+import org.jclouds.docker.options.DeleteImageOptions;
+import org.jclouds.docker.options.ListContainerOptions;
+import org.jclouds.docker.options.ListImageOptions;
+import org.jclouds.docker.options.RemoveContainerOptions;
+import org.jclouds.io.Payload;
+import org.jclouds.rest.annotations.BinderParam;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.Headers;
+import org.jclouds.rest.binders.BindToJsonPayload;
+
+/**
+ * @author Andrea Turli
+ */
+@Consumes(MediaType.APPLICATION_JSON)
+public interface RemoteApi extends Closeable {
+
+   /**
+    * Get the information of the current docker version.
+    *
+    * @return The information of the current docker version.
+    */
+   @Named("version")
+   @GET
+   @Path("/version")
+   Version getVersion();
+
+   /**
+    * List all running containers
+    *
+    * @return a set of containers
+    */
+   @Named("containers:list")
+   @GET
+   @Path("/containers/json")
+   @Fallback(Fallbacks.EmptySetOnNotFoundOr404.class)
+   Set<Container> listContainers();
+
+   /**
+    * List all running containers
+    *
+    * @param options the options to list the containers (@see ListContainerOptions)
+    * @return a set of containers
+    */
+   @Named("containers:list")
+   @GET
+   @Path("/containers/json")
+   @Fallback(Fallbacks.EmptySetOnNotFoundOr404.class)
+   Set<Container> listContainers(ListContainerOptions options);
+
+   /**
+    * Create a container
+    *
+    * @param name the name for the new container. Must match /?[a-zA-Z0-9_-]+.
+    * @param config the container’s configuration (@see BindToJsonPayload)
+    * @return a new container
+    */
+   @Named("container:create")
+   @POST
+   @Path("/containers/create")
+   Container createContainer(@QueryParam("name") String name, @BinderParam(BindToJsonPayload.class) Config config);
+
+   /**
+    * Return low-level information on the container id
+    * @param containerId  The id of the container to get.
+    * @return The details of the container or <code>null</code> if the container with the given id doesn't exist.
+    */
+   @Named("container:inspect")
+   @GET
+   @Path("/containers/{id}/json")
+   @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+   Container inspectContainer(@PathParam("id") String containerId);
+
+   /**
+    * Remove the container by id from the filesystem
+    *
+    * @param containerId The id of the container to be removed.
+    */
+   @Named("container:delete")
+   @DELETE
+   @Path("/containers/{id}")
+   void removeContainer(@PathParam("id") String containerId);
+
+   /**
+    * Remove the container by id from the filesystem
+    *
+    * @param containerId The id of the container to be removed.
+    * @param options the operation’s configuration (@see RemoveContainerOptions)
+    */
+   @Named("container:delete")
+   @DELETE
+   @Path("/containers/{id}")
+   void removeContainer(@PathParam("id") String containerId, RemoveContainerOptions options);
+
+   /**
+    * Start a container by id.
+    *
+    * @param containerId The id of the container to be started.
+    */
+   @Named("container:start")
+   @POST
+   @Path("/containers/{id}/start")
+   void startContainer(@PathParam("id") String containerId);
+
+   /**
+    * Start a container.
+    *
+    * @param containerId The id of the container to be started.
+    * @param hostConfig the container’s host configuration
+    */
+   @Named("container:start")
+   @POST
+   @Path("/containers/{id}/start")
+   void startContainer(@PathParam("id") String containerId, @BinderParam(BindToJsonPayload.class) HostConfig hostConfig);
+
+   /**
+    * Stop a container by id.
+    *
+    * @param containerId The id of the container to be stopped.
+    * @return the stream of the stop execution.
+    */
+   @Named("container:stop")
+   @POST
+   @Path("/containers/{id}/stop")
+   void stopContainer(@PathParam("id") String containerId);
+
+   /**
+    * Create a new image from a container’s changes
+    *
+    * @param options the commit’s configuration (@see CommitOptions)
+    * @return a new image created from the current container's status.
+    */
+   @Named("container:commit")
+   @POST
+   @Path("/commit")
+   Image commit(CommitOptions options);
+
+   /**
+    * List images
+    *
+    * @return the images available.
+    */
+   @Named("images:list")
+   @GET
+   @Path("/images/json")
+   @Fallback(Fallbacks.EmptySetOnNotFoundOr404.class)
+   Set<Image> listImages();
+
+   /**
+    * List images
+    *
+    * @param options the configuration to list images (@see ListImageOptions)
+    * @return the images available.
+    */
+   @Named("images:list")
+   @GET
+   @Path("/images/json")
+   @Fallback(Fallbacks.EmptySetOnNotFoundOr404.class)
+   Set<Image> listImages(ListImageOptions options);
+
+   /**
+    * Inspect an image
+    *
+    * @param imageId The id of the image to inspect.
+    * @return low-level information on the image name
+    */
+   @Named("image:inspect")
+   @GET
+   @Path("/images/{name}/json")
+   Image inspectImage(@PathParam("name") String imageName);
+
+   /**
+    * Create an image, either by pull it from the registry or by importing it
+    *
+    * @param options the configuration to create an image (@see CreateImageOptions)
+    * @return a stream of the image creation.
+    */
+   @Named("image:create")
+   @POST
+   @Path("/images/create")
+   InputStream createImage(CreateImageOptions options);
+
+   /**
+    * Delete an image.
+    *
+    * @param name the image name to be deleted
+    * @return the stream of the deletion execution.
+    */
+   @Named("image:delete")
+   @DELETE
+   @Path("/images/{name}")
+   InputStream deleteImage(@PathParam("name") String name);
+
+   /**
+    * Remove the image from the filesystem by name
+    *
+    * @param name the name of the image to be removed
+    * @param options the image deletion's options (@see DeleteImageOptions)
+    * @return the stream of the deletion execution.
+    */
+   @Named("image:delete")
+   @DELETE
+   @Path("/images/{name}")
+   InputStream deleteImage(@PathParam("name") String name, DeleteImageOptions options);
+
+   /**
+    * Build an image from Dockerfile via stdin
+    *
+    * @param inputStream The stream must be a tar archive compressed with one of the following algorithms: identity
+    *                    (no compression), gzip, bzip2, xz.
+    * @param options the image build's options (@see BuildOptions)
+    * @return a stream of the build execution
+    */
+   @Named("image:build")
+   @POST
+   @Path("/build")
+   @Headers(keys = "Content-Type", values = "application/tar")
+   InputStream build(Payload inputStream, BuildOptions options);
+
+   /**
+    * Build an image from Dockerfile via stdin
+    *
+    * @param dockerFile The file to be compressed with one of the following algorithms: identity, gzip, bzip2, xz.*
+    * @param options the image build's options (@see BuildOptions)
+    * @return a stream of the build execution
+    */
+   @Named("image:build")
+   @POST
+   @Path("/build")
+   @Headers(keys = "Content-Type", values = "application/tar")
+   InputStream build(@BinderParam(BindInputStreamToRequest.class) File dockerFile, BuildOptions options);
+
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/d45ad99a/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/compute/features/internal/Archives.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/compute/features/internal/Archives.java b/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/compute/features/internal/Archives.java
new file mode 100644
index 0000000..49641b9
--- /dev/null
+++ b/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/compute/features/internal/Archives.java
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.docker.compute.features.internal;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.collect.Iterables.getLast;
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
+import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream;
+
+import com.google.common.base.Splitter;
+
+/**
+ * @author Andrea Turli
+ */
+public class Archives {
+
+   public static File tar(File baseDir, String archivePath) throws IOException {
+      // Check that the directory is a directory, and get its contents
+      checkArgument(baseDir.isDirectory(), "%s is not a directory", baseDir);
+      File[] files = baseDir.listFiles();
+      File tarFile = new File(archivePath);
+
+      String token = getLast(Splitter.on("/").split(archivePath.substring(0, archivePath.lastIndexOf("/"))));
+
+      byte[] buf = new byte[1024];
+      int len;
+      TarArchiveOutputStream tos = new TarArchiveOutputStream(new FileOutputStream(tarFile));
+      tos.setLongFileMode(TarArchiveOutputStream.LONGFILE_GNU);
+      for (File file : files) {
+         TarArchiveEntry tarEntry = new TarArchiveEntry(file);
+         tarEntry.setName("/" + getLast(Splitter.on(token).split(file.toString())));
+         tos.putArchiveEntry(tarEntry);
+         if (!file.isDirectory()) {
+            FileInputStream fin = new FileInputStream(file);
+            BufferedInputStream in = new BufferedInputStream(fin);
+            while ((len = in.read(buf)) != -1) {
+               tos.write(buf, 0, len);
+            }
+            in.close();
+         }
+         tos.closeArchiveEntry();
+      }
+      tos.close();
+      return tarFile;
+   }
+
+   public static File tar(File baseDir, File tarFile) throws IOException {
+      // Check that the directory is a directory, and get its contents
+      checkArgument(baseDir.isDirectory(), "%s is not a directory", baseDir);
+      File[] files = baseDir.listFiles();
+
+      String token = getLast(Splitter.on("/").split(baseDir.getAbsolutePath()));
+
+      byte[] buf = new byte[1024];
+      int len;
+      TarArchiveOutputStream tos = new TarArchiveOutputStream(new FileOutputStream(tarFile));
+      tos.setLongFileMode(TarArchiveOutputStream.LONGFILE_GNU);
+      for (File file : files) {
+         TarArchiveEntry tarEntry = new TarArchiveEntry(file);
+         tarEntry.setName("/" + getLast(Splitter.on(token).split(file.toString())));
+         tos.putArchiveEntry(tarEntry);
+         if (!file.isDirectory()) {
+            FileInputStream fin = new FileInputStream(file);
+            BufferedInputStream in = new BufferedInputStream(fin);
+            while ((len = in.read(buf)) != -1) {
+               tos.write(buf, 0, len);
+            }
+            in.close();
+         }
+         tos.closeArchiveEntry();
+      }
+      tos.close();
+      return tarFile;
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/d45ad99a/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/compute/functions/ContainerToNodeMetadata.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/compute/functions/ContainerToNodeMetadata.java b/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/compute/functions/ContainerToNodeMetadata.java
new file mode 100644
index 0000000..8cbcd6c
--- /dev/null
+++ b/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/compute/functions/ContainerToNodeMetadata.java
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.docker.compute.functions;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.collect.Iterables.getOnlyElement;
+import java.net.URI;
+import java.util.List;
+import java.util.Map;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.jclouds.compute.domain.HardwareBuilder;
+import org.jclouds.compute.domain.NodeMetadata;
+import org.jclouds.compute.domain.NodeMetadataBuilder;
+import org.jclouds.compute.domain.OperatingSystem;
+import org.jclouds.compute.domain.OsFamily;
+import org.jclouds.compute.domain.Processor;
+import org.jclouds.compute.functions.GroupNamingConvention;
+import org.jclouds.compute.reference.ComputeServiceConstants;
+import org.jclouds.docker.domain.Container;
+import org.jclouds.docker.domain.Port;
+import org.jclouds.docker.domain.State;
+import org.jclouds.domain.LocationBuilder;
+import org.jclouds.domain.LocationScope;
+import org.jclouds.logging.Logger;
+import org.jclouds.providers.ProviderMetadata;
+
+import com.google.common.base.Function;
+import com.google.common.collect.ImmutableList;
+import com.google.inject.Singleton;
+
+/**
+ * @author Andrea Turli
+ */
+@Singleton
+public class ContainerToNodeMetadata implements Function<Container, NodeMetadata> {
+
+   @Resource
+   @Named(ComputeServiceConstants.COMPUTE_LOGGER)
+   protected Logger logger = Logger.NULL;
+
+   private final ProviderMetadata providerMetadata;
+   private final Function<State, NodeMetadata.Status> toPortableStatus;
+   private final GroupNamingConvention nodeNamingConvention;
+
+   @Inject
+   public ContainerToNodeMetadata(ProviderMetadata providerMetadata, Function<State,
+           NodeMetadata.Status> toPortableStatus, GroupNamingConvention.Factory namingConvention) {
+      this.providerMetadata = checkNotNull(providerMetadata, "providerMetadata");
+      this.toPortableStatus = checkNotNull(toPortableStatus, "toPortableStatus cannot be null");
+      this.nodeNamingConvention = checkNotNull(namingConvention, "namingConvention").createWithoutPrefix();
+   }
+
+   @Override
+   public NodeMetadata apply(Container container) {
+      String name = cleanUpName(container.getName());
+      String group = nodeNamingConvention.extractGroup(name);
+      NodeMetadataBuilder builder = new NodeMetadataBuilder();
+      builder.ids(container.getId())
+              .name(name)
+              .group(group)
+              .hostname(container.getConfig().getHostname())
+               // TODO Set up hardware
+              .hardware(new HardwareBuilder()
+                      .id("")
+                      .ram(container.getConfig().getMemory())
+                      .processor(new Processor(container.getConfig().getCpuShares(), container.getConfig().getCpuShares()))
+                      .build());
+      // TODO Set up location properly
+      LocationBuilder locationBuilder = new LocationBuilder();
+      locationBuilder.description("");
+      locationBuilder.id("");
+      locationBuilder.scope(LocationScope.HOST);
+      builder.location(locationBuilder.build());
+      builder.status(toPortableStatus.apply(container.getState()));
+      builder.imageId(container.getImage());
+      builder.loginPort(getLoginPort(container));
+      builder.publicAddresses(getPublicIpAddresses());
+      builder.privateAddresses(getPrivateIpAddresses(container));
+      builder.operatingSystem(OperatingSystem.builder().description("linux").family(OsFamily.LINUX).build());
+      return builder.build();
+   }
+
+   private String cleanUpName(String name) {
+      return name.startsWith("/") ? name.substring(1) : name;
+   }
+
+   private Iterable<String> getPrivateIpAddresses(Container container) {
+      if (container.getNetworkSettings() == null) return ImmutableList.of();
+      return ImmutableList.of(container.getNetworkSettings().getIpAddress());
+   }
+
+   private List<String> getPublicIpAddresses() {
+      String dockerIpAddress = URI.create(providerMetadata.getEndpoint()).getHost();
+      return ImmutableList.of(dockerIpAddress);
+   }
+
+   protected static int getLoginPort(Container container) {
+      if (container.getNetworkSettings() != null) {
+          Map<String, List<Map<String,String>>> ports = container.getNetworkSettings().getPorts();
+          if(ports != null) {
+            return Integer.parseInt(getOnlyElement(ports.get("22/tcp")).get("HostPort"));
+          }
+      // this is needed in case the container list is coming from listContainers
+      } else if (container.getPorts() != null) {
+         for (Port port : container.getPorts()) {
+            if (port.getPrivatePort() == 22) {
+               return port.getPublicPort();
+            }
+         }
+      }
+      throw new IllegalStateException("Cannot determine the login port for " + container.getId());
+   }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/d45ad99a/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/compute/functions/ImageToImage.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/compute/functions/ImageToImage.java b/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/compute/functions/ImageToImage.java
new file mode 100644
index 0000000..bcbc53f
--- /dev/null
+++ b/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/compute/functions/ImageToImage.java
@@ -0,0 +1,104 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.docker.compute.functions;
+
+import com.google.common.base.Function;
+import com.google.common.base.Splitter;
+import com.google.common.collect.Iterables;
+import org.jclouds.compute.domain.Image;
+import org.jclouds.compute.domain.ImageBuilder;
+import org.jclouds.compute.domain.OperatingSystem;
+import org.jclouds.compute.domain.OsFamily;
+import org.jclouds.compute.reference.ComputeServiceConstants;
+import org.jclouds.logging.Logger;
+
+import javax.annotation.Resource;
+import javax.inject.Named;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.collect.Iterables.get;
+
+/**
+ * @author Andrea Turli
+ */
+public class ImageToImage implements Function<org.jclouds.docker.domain.Image, org.jclouds.compute.domain.Image> {
+
+   private static final String CENTOS = "centos";
+   private static final String UBUNTU = "ubuntu";
+
+   @Resource
+   @Named(ComputeServiceConstants.COMPUTE_LOGGER)
+   protected Logger logger = Logger.NULL;
+
+   @Override
+   public Image apply(org.jclouds.docker.domain.Image from) {
+      checkNotNull(from, "image");
+      String description = checkNotNull(Iterables.getFirst(from.getRepoTags(), null));
+
+      OsFamily osFamily = osFamily().apply(description);
+      String osVersion = parseVersion(description);
+
+      OperatingSystem os = OperatingSystem.builder()
+              .description(description)
+              .family(osFamily)
+              .version(osVersion)
+              .is64Bit(is64bit(from))
+              .build();
+
+      return new ImageBuilder()
+              .ids(from.getId())
+              .name(get(Splitter.on(":").split(description), 0))
+              .description(description)
+              .operatingSystem(os)
+              .status(Image.Status.AVAILABLE)
+              .build();
+   }
+
+   private boolean is64bit(org.jclouds.docker.domain.Image inspectedImage) {
+      if(inspectedImage.getArchitecture() == null) return true;
+      return inspectedImage.getArchitecture().matches("x86_64|amd64");
+   }
+
+   /**
+    * Parses the item description to determine the OSFamily
+    *
+    * @return the @see OsFamily or OsFamily.UNRECOGNIZED
+    */
+   private Function<String, OsFamily> osFamily() {
+      return new Function<String, OsFamily>() {
+         OsFamily osFamily = OsFamily.UNRECOGNIZED;
+
+         @Override
+         public OsFamily apply(final String description) {
+            if (description != null) {
+               if (description.contains(CENTOS)) osFamily = OsFamily.CENTOS;
+               else if (description.contains(UBUNTU))
+                  osFamily = OsFamily.UBUNTU;
+            }
+            logger.debug("os family for item: %s is %s", description, osFamily);
+            return osFamily;
+         }
+      };
+   }
+
+   private String parseVersion(String description) {
+      String version = get(Splitter.on(":").split(description), 1);
+      logger.debug("os version for item: %s is %s", description, version);
+      return version;
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/d45ad99a/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/compute/functions/StateToStatus.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/compute/functions/StateToStatus.java b/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/compute/functions/StateToStatus.java
new file mode 100644
index 0000000..d2df146
--- /dev/null
+++ b/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/compute/functions/StateToStatus.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.docker.compute.functions;
+
+import com.google.common.base.Function;
+import org.jclouds.compute.domain.NodeMetadata;
+import org.jclouds.compute.domain.NodeMetadata.Status;
+import org.jclouds.docker.domain.State;
+
+import javax.inject.Singleton;
+
+/**
+ * Transforms an {@link org.jclouds.docker.domain.Container} to the jclouds portable model.
+ *
+ * @author Andrea Turli
+ */
+@Singleton
+public class StateToStatus implements Function<State, Status> {
+
+   @Override
+   public Status apply(final State state) {
+      if (state == null) return Status.UNRECOGNIZED;
+      return state.isRunning() ? NodeMetadata.Status.RUNNING : NodeMetadata.Status.SUSPENDED;
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/d45ad99a/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/compute/options/DockerTemplateOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/compute/options/DockerTemplateOptions.java b/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/compute/options/DockerTemplateOptions.java
new file mode 100644
index 0000000..1303756
--- /dev/null
+++ b/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/compute/options/DockerTemplateOptions.java
@@ -0,0 +1,365 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.docker.compute.options;
+
+import static com.google.common.base.Objects.equal;
+import java.util.Map;
+
+import org.jclouds.compute.options.TemplateOptions;
+import org.jclouds.domain.LoginCredentials;
+import org.jclouds.scriptbuilder.domain.Statement;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Optional;
+import com.google.common.collect.ImmutableMap;
+
+/**
+ * Contains options supported in the {@code ComputeService#runNode} operation on the
+ * "docker" provider. <h2>Usage</h2> The recommended way to instantiate a
+ * DockerTemplateOptions object is to statically import DockerTemplateOptions.* and invoke a static
+ * creation method followed by an instance mutator (if needed):
+ * <p/>
+ * <code>
+ * import static org.jclouds.aws.ec2.compute.options.DockerTemplateOptions.Builder.*;
+ * <p/>
+ * ComputeService api = // get connection
+ * templateBuilder.options(inboundPorts(22, 80, 8080, 443));
+ * Set<? extends NodeMetadata> set = api.createNodesInGroup(tag, 2, templateBuilder.build());
+ * <code>
+ *
+ * @author Andrea Turli
+ */
+public class DockerTemplateOptions extends TemplateOptions implements Cloneable {
+   @Override
+   public DockerTemplateOptions clone() {
+      DockerTemplateOptions options = new DockerTemplateOptions();
+      copyTo(options);
+      return options;
+   }
+
+   @Override
+   public void copyTo(TemplateOptions to) {
+      super.copyTo(to);
+      if (to instanceof DockerTemplateOptions) {
+         DockerTemplateOptions eTo = DockerTemplateOptions.class.cast(to);
+         if (getVolumes().isPresent()) {
+            eTo.volumes(getVolumes().get());
+         }
+      }
+   }
+
+   protected Optional<Map<String, String>> volumes = Optional.absent();
+
+   @Override
+   public boolean equals(Object o) {
+      if (this == o)
+         return true;
+      if (o == null || getClass() != o.getClass())
+         return false;
+      DockerTemplateOptions that = DockerTemplateOptions.class.cast(o);
+      return super.equals(that) && equal(this.volumes, that.volumes);
+   }
+
+   @Override
+   public int hashCode() {
+      return Objects.hashCode(super.hashCode(), volumes);
+   }
+
+   @Override
+   public Objects.ToStringHelper string() {
+      Objects.ToStringHelper toString = super.string();
+      if (volumes.isPresent())
+         toString.add("volumes", volumes.get());
+      return toString;
+   }
+
+   public static final DockerTemplateOptions NONE = new DockerTemplateOptions();
+
+   public DockerTemplateOptions volumes(Map<String, String> volumes) {
+      this.volumes = Optional.<Map<String, String>> of(ImmutableMap.copyOf(volumes));
+      return this;
+   }
+
+   public Optional<Map<String, String>> getVolumes() {
+      return volumes;
+   }
+
+   public static class Builder {
+
+      /**
+       * @see DockerTemplateOptions#volumes(java.util.Map)
+       */
+      public static DockerTemplateOptions volumes(Map<String, String> volumes) {
+         DockerTemplateOptions options = new DockerTemplateOptions();
+         return DockerTemplateOptions.class.cast(options.volumes(volumes));
+      }
+
+      // methods that only facilitate returning the correct object type
+
+      /**
+       * @see TemplateOptions#inboundPorts
+       */
+      public static DockerTemplateOptions inboundPorts(int... ports) {
+         DockerTemplateOptions options = new DockerTemplateOptions();
+         return DockerTemplateOptions.class.cast(options.inboundPorts(ports));
+      }
+
+      /**
+       * @see TemplateOptions#port
+       */
+      public static DockerTemplateOptions blockOnPort(int port, int seconds) {
+         DockerTemplateOptions options = new DockerTemplateOptions();
+         return DockerTemplateOptions.class.cast(options.blockOnPort(port, seconds));
+      }
+
+      /**
+       * @see TemplateOptions#installPrivateKey
+       */
+      public static DockerTemplateOptions installPrivateKey(String rsaKey) {
+         DockerTemplateOptions options = new DockerTemplateOptions();
+         return DockerTemplateOptions.class.cast(options.installPrivateKey(rsaKey));
+      }
+
+      /**
+       * @see TemplateOptions#authorizePublicKey
+       */
+      public static DockerTemplateOptions authorizePublicKey(String rsaKey) {
+         DockerTemplateOptions options = new DockerTemplateOptions();
+         return DockerTemplateOptions.class.cast(options.authorizePublicKey(rsaKey));
+      }
+
+      /**
+       * @see TemplateOptions#userMetadata
+       */
+      public static DockerTemplateOptions userMetadata(Map<String, String> userMetadata) {
+         DockerTemplateOptions options = new DockerTemplateOptions();
+         return DockerTemplateOptions.class.cast(options.userMetadata(userMetadata));
+      }
+
+      /**
+       * @see TemplateOptions#nodeNames(Iterable)
+       */
+      public static DockerTemplateOptions nodeNames(Iterable<String> nodeNames) {
+         DockerTemplateOptions options = new DockerTemplateOptions();
+         return DockerTemplateOptions.class.cast(options.nodeNames(nodeNames));
+      }
+
+      /**
+       * @see TemplateOptions#networks(Iterable)
+       */
+      public static DockerTemplateOptions networks(Iterable<String> networks) {
+         DockerTemplateOptions options = new DockerTemplateOptions();
+         return DockerTemplateOptions.class.cast(options.networks(networks));
+      }
+
+      /**
+       * @see TemplateOptions#overrideLoginUser
+       */
+      public static DockerTemplateOptions overrideLoginUser(String user) {
+         DockerTemplateOptions options = new DockerTemplateOptions();
+         return options.overrideLoginUser(user);
+      }
+
+      /**
+       * @see TemplateOptions#overrideLoginPassword
+       */
+      public static DockerTemplateOptions overrideLoginPassword(String password) {
+         DockerTemplateOptions options = new DockerTemplateOptions();
+         return options.overrideLoginPassword(password);
+      }
+
+      /**
+       * @see TemplateOptions#overrideLoginPrivateKey
+       */
+      public static DockerTemplateOptions overrideLoginPrivateKey(String privateKey) {
+         DockerTemplateOptions options = new DockerTemplateOptions();
+         return options.overrideLoginPrivateKey(privateKey);
+      }
+
+      /**
+       * @see TemplateOptions#overrideAuthenticateSudo
+       */
+      public static DockerTemplateOptions overrideAuthenticateSudo(boolean authenticateSudo) {
+         DockerTemplateOptions options = new DockerTemplateOptions();
+         return options.overrideAuthenticateSudo(authenticateSudo);
+      }
+
+      /**
+       * @see TemplateOptions#overrideLoginCredentials
+       */
+      public static DockerTemplateOptions overrideLoginCredentials(LoginCredentials credentials) {
+         DockerTemplateOptions options = new DockerTemplateOptions();
+         return options.overrideLoginCredentials(credentials);
+      }
+
+      /**
+       * @see TemplateOptions#blockUntilRunning
+       */
+      public static DockerTemplateOptions blockUntilRunning(boolean blockUntilRunning) {
+         DockerTemplateOptions options = new DockerTemplateOptions();
+         return options.blockUntilRunning(blockUntilRunning);
+      }
+
+   }
+
+   // methods that only facilitate returning the correct object type
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public DockerTemplateOptions blockOnPort(int port, int seconds) {
+      return DockerTemplateOptions.class.cast(super.blockOnPort(port, seconds));
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public DockerTemplateOptions inboundPorts(int... ports) {
+      return DockerTemplateOptions.class.cast(super.inboundPorts(ports));
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public DockerTemplateOptions authorizePublicKey(String publicKey) {
+      return DockerTemplateOptions.class.cast(super.authorizePublicKey(publicKey));
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public DockerTemplateOptions installPrivateKey(String privateKey) {
+      return DockerTemplateOptions.class.cast(super.installPrivateKey(privateKey));
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public DockerTemplateOptions blockUntilRunning(boolean blockUntilRunning) {
+      return DockerTemplateOptions.class.cast(super.blockUntilRunning(blockUntilRunning));
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public DockerTemplateOptions dontAuthorizePublicKey() {
+      return DockerTemplateOptions.class.cast(super.dontAuthorizePublicKey());
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public DockerTemplateOptions nameTask(String name) {
+      return DockerTemplateOptions.class.cast(super.nameTask(name));
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public DockerTemplateOptions runAsRoot(boolean runAsRoot) {
+      return DockerTemplateOptions.class.cast(super.runAsRoot(runAsRoot));
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public DockerTemplateOptions runScript(Statement script) {
+      return DockerTemplateOptions.class.cast(super.runScript(script));
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public DockerTemplateOptions overrideLoginCredentials(LoginCredentials overridingCredentials) {
+      return DockerTemplateOptions.class.cast(super.overrideLoginCredentials(overridingCredentials));
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public DockerTemplateOptions overrideLoginPassword(String password) {
+      return DockerTemplateOptions.class.cast(super.overrideLoginPassword(password));
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public DockerTemplateOptions overrideLoginPrivateKey(String privateKey) {
+      return DockerTemplateOptions.class.cast(super.overrideLoginPrivateKey(privateKey));
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public DockerTemplateOptions overrideLoginUser(String loginUser) {
+      return DockerTemplateOptions.class.cast(super.overrideLoginUser(loginUser));
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public DockerTemplateOptions overrideAuthenticateSudo(boolean authenticateSudo) {
+      return DockerTemplateOptions.class.cast(super.overrideAuthenticateSudo(authenticateSudo));
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public DockerTemplateOptions userMetadata(Map<String, String> userMetadata) {
+      return DockerTemplateOptions.class.cast(super.userMetadata(userMetadata));
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public DockerTemplateOptions userMetadata(String key, String value) {
+      return DockerTemplateOptions.class.cast(super.userMetadata(key, value));
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public DockerTemplateOptions nodeNames(Iterable<String> nodeNames) {
+      return DockerTemplateOptions.class.cast(super.nodeNames(nodeNames));
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public DockerTemplateOptions networks(Iterable<String> networks) {
+      return DockerTemplateOptions.class.cast(super.networks(networks));
+   }
+
+}


Mime
View raw message