Configure Couchbase Docker Container using REST API

Couchbase Docker image is published at hub.docker.com/_/couchbase. The easiest way to start this image is:

8091 is the network port used by Couchbase Web Console for REST traffic. Complete set of ports are documented at Couchbase Network Configuration. This image can be configured using Single Host Single Container configuration as explained at hub.docker.com/_/couchbase.

This blog will show you can create a single node Couchbase cluster using Docker, configure it with Data, Index, and Query service, load a sample bucket, and query it.

Couchbase Docker Container

Start Couchbase Docker Container

Start Couchbase Docker Container using the following docker-compose.yml:

This Docker Compose file can be downloaded from github.com/arun-gupta/docker-images/tree/master/couchbase-server.

The container can be started as:

Status of the running container can be seen as:

Logs can be seen as:

Configure Couchbase Docker Container

  1. Get IP address of the Docker Host:

    Use this IP address in all the subsequent commands.

  2. Configure memory for Data and Index services:

  3. Configure Data, Query, and Index services:

  4. Setup credentials for the cluster:

Install Couchbase Travel Sample Bucket

Query Couchbase Docker Container using CBQ

  1. List container id of Couchbase server:

    This output shows the complete information about the container. Alternatively, just the container id can be obtained as:

  2. Run Couchbase Query tool:

  3. Run a query:

    Did you realize, this was a SQL query for JSON document? How cool.  Learn more about in this interactive N1QL tutorial.

Cluster overview can be seen at 192.168.99.100:8091:

Couchbase Docker Container Cluster Overview

Data buckets can seen as:

Couchbase Docker Container Databucket

Ask your questions at forums.couchbase.com, learn more about Couchbase REST API or read more in Couchbase 4 Docs.

A subsequent blog will show how all of these steps can be fully automated.

Enjoy!

Be Sociable, Share!

3 thoughts on “Configure Couchbase Docker Container using REST API

Leave a Reply

Your email address will not be published. Required fields are marked *