Couchbase Server: Getting Started With Docker Cloud

DZone 's Guide to

Couchbase Server: Getting Started With Docker Cloud

In this post, you'll learn the key concepts of Docker Cloud and how to get started with it using Couchbase Server for the Docker image.

· Cloud Zone ·
Free Resource

Deploying Docker to Amazon using Tutum explained how to deploy a Docker image to Docker Tutum. Tutum is now Docker Cloud.

Read Announcing Docker Cloud for more details.

Docker Cloud Logo

The key features of Docker Cloud are:

  • Authentication using Docker ID
  • Integration with Docker Hub
  • Support for Docker official repositories
  • Commercially supported Docker Engine
  • Ability to deploy and scale your applications using GUI, API, and CLI

This blog will show:

  • Key concepts of Docker Cloud
  • How to create a new Docker Cloud Node
  • How to install Docker Cloud CLI
  • How to create a new Docker Cloud Service
  • Access Couchbase Server in Docker Cloud
  • How to terminate the Docker Cloud Service and Node

And finally, it’ll leave with some references for Docker Cloud docs.

The blog will use Couchbase Server – an open source, highly scalable, JSON document database for the Docker image.

Docker Cloud TL;DR

Here are the quick commands to run a Docker image using Docker Cloud in Amazon:

brew install docker-cloud
docker-cloud nodecluster create -t 1 --tag couchbase couchbase-node aws us-west-1 m3.large 
docker-cloud service create --tag couchbase -p 8091:8091 -p 8092:8092 -p 8093:8093 -p 11210:11210 arungupta/couchbase
docker-cloud service start {SERVICE_ID}
docker-cloud service inspect {SERVICE_ID} | jq ".container_ports[0].endpoint_uri" | sed 's/tcp/http/g'

More details below.

Key Concepts of Docker Cloud

Let’s understand the core concepts of Docker Cloud:

  • Nodes are individual Linux hosts/VMs used to deploy and run your applications. New nodes can be provisioned to increase the capacity. Docker Cloud does not provide hosting services. Nodes are provisioned using physical servers, virtual machine or cloud providers.
  • Node Clusters are logical groups of nodes of the same type. Node Clusters allow one to scale the infrastructure easily by provisioning more nodes.
  • Services are logical groups of containers from the same image. Services make it simple to scale your application across different nodes.

Docker Cloud can be managed with WebCLI, or REST API. This blog will use the Docker Cloud CLI to perform all the commands.

Install Docker Cloud CLI

Install Docker Cloud CLI:

brew install docker-cloud
==> Downloading https://homebrew.bintray.com/bottles/docker-cloud-1.0.2.yosemite.bottle.tar.gz
Already downloaded: /Library/Caches/Homebrew/docker-cloud-1.0.2.yosemite.bottle.tar.gz
==> Pouring docker-cloud-1.0.2.yosemite.bottle.tar.gz
��  /usr/local/Cellar/docker-cloud/1.0.2: 482 files, 4.1M

Complete installation instructions are at Installing CLI.

Check version:

docker-cloud -v
docker-cloud 1.0.2

Complete set of commands are:

usage: docker-cloud [-h] [-v]

Docker Cloud CLI

optional arguments:
  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit

Docker Cloud CLI commands:
    action              Action-related operations
    container           Container-related operations
    event               Get real time Docker Cloud events
    exec                Run a command in a running container
    login               Please use "docker login" to log into Docker Cloud
    node                Node-related operations
    nodecluster         NodeCluster-related operations
    repository          Repository-related operations
    run                 Create and run a new service
    service             Service-related operations
    stack               Stack-related operations
    tag                 Tag-related operations
    trigger             Trigger-related operations
    up                  Create and deploy a stack

Save the login credentials:

docker login
Username: arungupta
Email: arun.gupta@gmail.com
WARNING: login credentials saved in /Users/arungupta/.docker/config.json
Login Succeeded

Create New Docker Cloud Node

Register your cloud provider credentials with Docker Cloud Web UI as explained in Link to a Cloud Service Provider. Amazon, Digital Ocean, Azure, and other cloud providers are supported.

Create a new node cluster with a single node:

docker-cloud nodecluster create -t 1 --tag couchbase couchbase-node aws us-west-1 m3.large 

This node cluster has a single node (-t 1) and uses the tag “couchbase” (--tag couchbase). Last four parameters are nodecluster name (couchbase-node, provider (aws, region (us-west-1 and nodetype (m3.large).

Each node in this node cluster will be given the assigned tag. This will be used later to assign services to a specific node or node cluster.

Status of this node cluster can be checked:

docker-cloud nodecluster inspect 42a34e04-02e1-47be-bf87-ec06e0e0b604 | jq
  "disk": 60,
  "uuid": "42a34e04-02e1-47be-bf87-ec06e0e0b604",
  "tags": [
      "name": "couchbase"
  "current_num_nodes": 1,
  "region": "/api/infra/v1/region/aws/us-west-1/",
  "target_num_nodes": 1,
  "state": "Deployed",
  "node_type": "/api/infra/v1/nodetype/aws/m3.large/",
  "resource_uri": "/api/infra/v1/nodecluster/42a34e04-02e1-47be-bf87-ec06e0e0b604/",
  "destroyed_datetime": null,
  "provider_options": {},
  "nodes": [
  "deployed_datetime": "Tue, 15 Mar 2016 17:18:17 +0000",
  "nickname": "couchbase-node",
  "dockercloud_action_uri": "",
  "name": "couchbase-node"

The dashboard at cloud.docker.com is updated to show:

Docker Cloud Node Created Dashboard

More information about each node can be seen as well:

Docker Cloud Created Node

Create a New Docker Cloud Service

Create a Docker Cloud Service:

docker-cloud service create -p 8091:8091 -p 8092:8092 -p 8093:8093 -p 11210:11210 arungupta/couchbase 

If multiple node clusters exists, then --tag is used to assign a service to a node cluster.

docker-cli#10 is filed to ensure multiple ports can be exposed using -p 8091-8093:8091-8093 format. This will be aligned with the docker CLI.

Docker image used here is arungupta/couchbase. This image is based on the official couchbase image at Docker Hub and pre-configures it for different services.

Start the Docker Cloud Service:

docker-cloud service start 834343fd-b1d5-4d66-a2cd-69d27a471658

The updated dashboard looks like:

Docker Cloud Service Started

Get the Docker Cloud Service logs:

docker-cloud service logs 834343fd-b1d5-4d66-a2cd-69d27a471658 
couchbase-d96eed5d-1 | 2016-03-14T22:54:04.826000846Z Starting Couchbase Server -- Web UI available at http://<ip>:8091
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.832855273Z *   Trying
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.833816400Z   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.834647384Z                                  Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Connected to ( port 8091 (#0)
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.835659864Z > POST /pools/default HTTP/1.1
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.835705633Z > User-Agent: curl/7.40.0-DEV
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.835764766Z > Host:
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.835808491Z > Accept: */*
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.835849972Z > Content-Length: 36
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.835890805Z > Content-Type: application/x-www-form-urlencoded
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.835951739Z > 
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.836153748Z } [36 bytes data]
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.836431490Z * upload completely sent off: 36 out of 36 bytes
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.838702601Z < HTTP/1.1 200 OK
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.838831946Z < Server: Couchbase Server
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.838882039Z < Pragma: no-cache
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.838929456Z < Date: Mon, 14 Mar 2016 22:54:19 GMT
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.838944199Z < Content-Length: 0
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.838973658Z < Cache-Control: no-cache
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.838984780Z < 
100    36    0     0  100    36      0   5643 --:--:-- --:--:-- --:--:--  6000
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.839338450Z * Connection #0 to host left intact
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.843462008Z *   Trying
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.844335715Z   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.845478686Z                                  Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Connected to ( port 8091 (#0)
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.845676061Z > POST /node/controller/setupServices HTTP/1.1
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.845729619Z > User-Agent: curl/7.40.0-DEV
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.845805193Z > Host:
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.845858410Z > Accept: */*
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.845911479Z > Content-Length: 26
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.845986653Z > Content-Type: application/x-www-form-urlencoded
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.846040578Z > 
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.846312512Z } [26 bytes data]
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.846561659Z * upload completely sent off: 26 out of 26 bytes
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.847024846Z < HTTP/1.1 200 OK
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.847082032Z < Server: Couchbase Server
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.847157246Z < Pragma: no-cache
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.847211690Z < Date: Mon, 14 Mar 2016 22:54:19 GMT
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.847266024Z < Content-Length: 0
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.847344403Z < Cache-Control: no-cache
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.847411160Z < 
100    26    0     0  100    26      0   6056 --:--:-- --:--:-- --:--:--  8666
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.849284426Z * Connection #0 to host left intact
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.853702443Z *   Trying
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.853890120Z   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.853943309Z                                  Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Connected to ( port 8091 (#0)
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.854112174Z > POST /settings/web HTTP/1.1
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.854169870Z > User-Agent: curl/7.40.0-DEV
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.854223412Z > Host:
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.854278756Z > Accept: */*
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.854335649Z > Content-Length: 50
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.854391073Z > Content-Type: application/x-www-form-urlencoded
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.854447141Z > 
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.854683623Z } [50 bytes data]
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.855024680Z * upload completely sent off: 50 out of 50 bytes
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.859378932Z < HTTP/1.1 200 OK
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.859530830Z < Server: Couchbase Server
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.859611527Z < Pragma: no-cache
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.859794083Z < Date: Mon, 14 Mar 2016 22:54:19 GMT
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.859848224Z < Content-Type: application/json
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.859912932Z < Content-Length: 39
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.859957829Z < Cache-Control: no-cache
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.859972017Z < 
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.859986584Z { [39 bytes data]
100    89  100    39  100    50   6060   7770 --:--:-- --:--:-- --:--:--  8333
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.860221103Z * Connection #0 to host left intact
couchbase-d96eed5d-1 | 2016-03-14T22:54:19.860730000Z {"newBaseUri":""}/entrypoint.sh couchbase-server

The log shows output from the Couchbase REST API invoked to configure the Couchbase server.

Access Couchbase Server in Docker Cloud

Inspect the Docker Cloud service for the exposed container ports:

docker-cloud service inspect 834343fd-b1d5-4d66-a2cd-69d27a471658 | jq ".container_ports"
    "protocol": "tcp",
    "outer_port": 8091,
    "inner_port": 8091,
    "port_name": "unknown",
    "published": true,
    "endpoint_uri": "tcp://couchbase-d96eed5d.834343fd.svc.dockerapp.io:8091/"
    "protocol": "tcp",
    "outer_port": 8092,
    "inner_port": 8092,
    "port_name": "unknown",
    "published": true,
    "endpoint_uri": "tcp://couchbase-d96eed5d.834343fd.svc.dockerapp.io:8092/"
    "protocol": "tcp",
    "outer_port": 8093,
    "inner_port": 8093,
    "port_name": "unknown",
    "published": true,
    "endpoint_uri": "tcp://couchbase-d96eed5d.834343fd.svc.dockerapp.io:8093/"
    "protocol": "tcp",
    "outer_port": 11210,
    "inner_port": 11210,
    "port_name": "unknown",
    "published": true,
    "endpoint_uri": "tcp://couchbase-d96eed5d.834343fd.svc.dockerapp.io:11210/"

To be more specific, exact URI for the Couchbase Web Console can be obtained as:

docker-cloud service inspect 834343fd-b1d5-4d66-a2cd-69d27a471658 | jq ".container_ports[0].endpoint_uri" | sed 's/tcp/http/g'

Access the Couchbase Web Console at http://couchbase-d96eed5d.834343fd.svc.dockerapp.io:8091/ to see the Couchbase Web Console login screen. Enter the password credentials of Administrator and password

Image title

And the Couchbase Web Console looks like:

Image title

Terminate the Docker Cloud Service and Node

Check the list of Docker Cloud services running:

docker-cloud service ps
NAME                UUID      STATUS       #CONTAINERS  IMAGE                       DEPLOYED        PUBLIC DNS                                      STACK
couchbase-d96eed5d  834343fd  ▶ Running              1  arungupta/couchbase:latest  26 minutes ago  couchbase-d96eed5d.834343fd.svc.dockerapp.io

Terminate the service:

docker-cloud service terminate couchbase-d96eed5d

Check the list of nodes:

docker-cloud node ls
UUID      FQDN                                                    LASTSEEN      STATUS      CLUSTER         DOCKER_VER
a8059155  a8059155-390c-42db-9fb1-3b1bd3fb222c.node.dockerapp.io  1 minute ago  ▶ Deployed  couchbase-node  1.9.1-cs2

Terminate the node as:

docker-cloud node rm a8059155

Docker Cloud References

In this blog, you learned:

  • Key concepts of Docker Cloud
  • How to create a new Docker Cloud Node
  • How to install Docker Cloud CLI
  • How to create a new Docker Cloud Service
  • Access Couchbase Server in Docker Cloud
  • How to terminate the Docker Cloud Service and Node
container, containerization, docker

Published at DZone with permission of Arun Gupta , DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}