Skip to content
This repository was archived by the owner on Feb 4, 2019. It is now read-only.

Commit

Permalink
Added Docker guide
Browse files Browse the repository at this point in the history
  • Loading branch information
andreaturli authored and nacx committed Jul 15, 2014
1 parent 83dff16 commit 1fc4b64
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 1 deletion.
3 changes: 2 additions & 1 deletion _layouts/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,11 @@ <h2>The Java Multi-Cloud Toolkit</h2>
</ul>
<ul class="list-inline text-center">
<li><img class="img-list" src="img/logos/digitalocean.png" alt="DigitalOcean" title="DigitalOcean"/></li>
<li><img class="img-list" src="img/logos/docker.png" alt="Docker" title="Docker"/></li>
<li><img class="img-list" src="img/logos/gcp.png" alt="Google Cloud Platform" title="Google Cloud Platform"/></li>
<li><img class="img-list" src="img/logos/hpcloud.png" alt="HP Cloud" title="HP Cloud"/></li>
</ul>
<ul class="list-inline text-center">
<li><img class="img-list" src="img/logos/hpcloud.png" alt="HP Cloud" title="HP Cloud"/></li>
<li><img class="img-list" src="img/logos/joyent.png" alt="Joyent" title="Joyent"/></li>
<li><img class="img-list" src="img/logos/openstack.png" alt="OpensStack" title="OpenStack"/></li>
<li><img class="img-list" src="img/logos/rackspace.png" alt="Rackspace" title="Rackspace"/></li>
Expand Down
44 changes: 44 additions & 0 deletions guides/docker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
layout: page
title: "Docker: Getting Started Guide"
permalink: /guides/docker/
---

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.

![jclouds docker architecture](/img/jclouds-docker.png)

In order to mimic the behavior of the nodes that jclouds is able to manage, we need to make the Docker containers similar to any other VM.
Fortunately, to have that is not much work: the only prerequisite is that the node needs to be ssh’able.
This involves [dockerizing an SSH daemon service](https://docs.docker.com/examples/running_ssh_service/).

### Give it a try!

* Install [Docker](http://https://docs.docker.com/installation/)
* Ensure you are using a recent JDK 7
* Setup your project to include `docker`
* Get the dependency `org.jclouds.labs/docker` using jclouds [Installation](/start/install).
* Start coding

{% highlight java %}
// get a context with docker that offers the portable ComputeService api
ComputeServiceContext context = ContextBuilder.newBuilder("docker")
.credentials(email, password)
.modules(ImmutableSet.<Module> of(new Log4JLoggingModule(),
new SshjSshClientModule()))
.buildView(ComputeServiceContext.class);
ComputeService client = context.getComputeService();

String sshableImageId = "your-sshable-image-id"; // this can be obtained using `docker images --no-trunc` command
Template template = client.templateBuilder().imageId(sshableImageId).build();

// run a couple nodes accessible via group container
Set<? extends NodeMetadata> nodes = client.runNodesInGroup("container", 2, template);

// release resources
context.close();
{% endhighlight %}

As for any other jclouds API, this code will create for you 2 nodes in the group `container` using the provided template.
The only (big) difference is that jclouds-docker will spin up 2 docker containers for you, instead of being 2 plain-old virtual machines, as it generally happens for the other cloud providers.
1 change: 1 addition & 0 deletions guides/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Use these guides for getting started with any of the cloud providers below:
* [Azure Storage](azure-storage)
* [BlueLock vCloud](bluelock)
* [Cloud Sigma](cloudsigma)
* [Docker](docker)
* [Go Grid](go-grid)
* [Google Cloud Platform](google)
* [HP Cloud](hpcloud)
Expand Down
Binary file added img/jclouds-docker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/logos/docker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions reference/providers.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ The Maven Group ID for all supported providers below is [org.apache.jclouds.prov
<td>digitalocean</td>
<td></td>
</tr>
<tr>
<td><a href="/guides/docker/">Docker*</a></td>
<td>docker</td>
<td></td>
</tr>
<tr>
<td>ElasticHosts GB</td>
<td>elastichosts-lon-b</td>
Expand Down

0 comments on commit 1fc4b64

Please sign in to comment.