Docker Cloud for AWS

In this blog, I will cover Docker cloud usage with AWS. This blog is part of my Docker for AWS series and uses the sample voting application for illustration.

Docker cloud is a hosted service from Docker to manage Containers. Docker cloud is free to try for 1 private repository and node and is chargeable after that. Docker cloud was originally an acquisition from Tutum. Docker cloud can be used to manage infrastructure nodes in the cloud or nodes in the local data center. For basics on Docker cloud/Tutum, please refer to my earlier blog here. Since Docker cloud was an acquisition, it does not use some of the Docker ecosystem software. Following are some important differences:

  • Docker cloud has its own orchestration engine rather than using Swarm.
  • Docker cloud uses Stackfile rather than using compose file for describing the application. There is an attempt to make Stackfile as close to compose file as possible.
  • Docker cloud uses Weave as the underlying overlay network rather than Docker overlay using libnetwork.
  • Service Discovery is in-built and uses DNS based load balancing rather than Service discovery approach used in Docker 1.12.

Following are the steps to create the voting application in Docker cloud:

  • Create multi-node cluster in AWS. We need to register AWS credentials first before we can create the cluster.
  • Create stackfile and deploy the stackfile in the multi-node cluster. Stackfile defines the multi-container application. Docker cloud uses Stackfile and also creates endpoints for individual services.


Following are some pre-requisites before we can deploy the voting application in AWS:

  • Create Docker cloud account.
  • Register AWS credentials in Docker cloud.
  • Install Docker-cloud CLI. Docker cloud can be managed either using web interface or docker-cloud CLI.
  • To ssh into individual nodes, we need to deploy “authorized_keys” service on all nodes of the cluster. This runs as a Container. For more details on this, please refer here.

Application deployment

Create multi-node cluster in AWS
I created 2 node cluster using Docker cloud GUI. Following command shows details of the cluster:

$ docker-cloud nodecluster ls
awstest  843c802d  us-west-2  t2.micro  14 days ago  Empty cluster                0               0
myaws    2f0533b9  us-west-2  t2.micro  3 hours ago  Deployed                     2               2

We are using cluster “myaws” for this example.

Following command shows details of the nodes in the cluster:

$ docker-cloud node ls
UUID      FQDN                                                    LASTSEEN        STATUS      CLUSTER    DOCKER_VER
60e1600a  21 minutes ago  ▶ Deployed  myaws      1.11.1-cs1
c4aba51d  21 minutes ago  ▶ Deployed  myaws      1.11.1-cs1

Above, we can see the 2 nodes.

Let’s deploy the voting application as shown below:

$ docker-cloud stack up -f voting.yml 

Following are the contents of “voting.yml” that shows the 2 services “client” and “vote”:

  image: 'smakam/myubuntu:v4'
  command: 'ping'
  restart: always
  image: 'instavote/vote:latest'
  deployment_strategy: high_availability
    - '8080:80'
  restart: always
  target_num_containers: 2

Following are some important specifics on the YML file above:

  • “restart” option allows for container restart in case it dies.
  • “target_num_containers” describes number of containers for a particular service. Default value is 1. In this example, we have used 2 instances of “vote” container.
  • “high_availability” strategy spreads the multiple instances of containers across nodes.

Following command lists the services deployed:

$ docker-cloud service ps
NAME            UUID      STATUS           #CONTAINERS  IMAGE                              DEPLOYED        PUBLIC DNS                                               STACK
authorizedkeys  a5424263  ◼ Not running              0  dockercloud/authorizedkeys:latest  2 hours ago  authorizedkeys
vote            bb5b21bc  ▶ Running                  2  instavote/vote:latest              27 minutes ago          dockercloudstack
client          d0f342fa  ▶ Running                  1  smakam/myubuntu:v4                 26 minutes ago        dockercloudstack

Above, we can see that the “client” and “vote” service is running.

Following command shows the Docker version running in the node:

# docker --version
Docker version 1.11.1-cs1, build bfd1f99

Docker cloud deploys custom AMI with Docker installed as well as the necessary system services.

Following command shows the containers running in node1:

# docker ps
CONTAINER ID        IMAGE                                   COMMAND                  CREATED             STATUS              PORTS                  NAMES
1b70e324c8d7        smakam/myubuntu:v4                      "ping"        30 minutes ago      Up 30 minutes                              client-1.dockercloudstack.825b9f18
9926c0c82868        instavote/vote:latest                   "gunicorn app:app -b "   30 minutes ago      Up 30 minutes>80/tcp   vote-2.dockercloudstack.c50f2bcc
e61c7cfcf7a5        dockercloud/cleanup:latest              "/"                3 hours ago         Up 3 hours                                 cleanup-59378.47087957
2b7f0c29ded8        dockercloud/logrotate:latest            "crond -f"               3 hours ago         Up 3 hours                                 logrotate-89401.514eac74
0f9bd75b318c        dockercloud/events:latest               "/events"                3 hours ago         Up 3 hours                                 events-70700.de5bba90
ed4e763aec8e        dockercloud/ntpd:latest                 "/"                3 hours ago         Up 3 hours                                 ntpd-75129.9cf0bf86
78c3b4bebab1        weaveworks/plugin:1.5.2                 "/home/weave/plugin"     3 hours ago         Up 3 hours                                 weaveplugin
64c3778e58eb        weaveworks/weave:1.5.2                  "/home/weave/weaver -"   3 hours ago         Up 3 hours                                 weave
734129420b6f        dockercloud/network-daemon:1.11.1-cs1   "/"                3 hours ago         Up 3 hours                                 weave-49562.4bf4a770

Except the first 2 containers above, remaining containers are Docker cloud system containers that helps with orchestration, networking, logging etc. Only 1 instance of “vote” service is running in node1, another instance runs in node2, Docker cloud takes care of orchestration and health check of containers in the service.

Lets get the service endpoint for the voting application:

$ docker-cloud service inspect vote | grep -i end
      "endpoint_uri": ""

Following output shows that access to the endpoint gets load balanced between the 2 “vote” containers:

$ curl | grep -i "container id"
           Processed by container ID vote-2
sreeni@ubuntu:~/dockercloudstack$ curl | grep -i "container id"
          Processed by container ID vote-1

We can also access the “vote” service from “client” service using hostname since they are part of the same stack.


2 thoughts on “Docker Cloud for AWS

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s