Ratnopam Chakrabarti is a software developer currently working for Ericsson Inc. He has been focused on IoT, machine-to-machine technologies, connected cars, and smart city domains for quite a while. He loves learning new technologies and putting them to work. When he’s not working, he enjoys spending time with his 3-year-old son.

Ratnopam Chakrabarti

While running the node app locally is fun, it still requires all the precautions of installing the prerequisite softwares such as Couchbase, etc. on the local system. An alternative is to use Docker to containerize the app and run it as a bundled image. The same can be done with the Couchbase container, thus we don’t have to install it locally.

Run Couchbase Custom Image

In order to run Couchbase using Docker, refer to the custom Couchbase image Dockerfile. It makes use of a script which can be found here.

The reason I am not using the base Couchbase image is because I want to preconfigure my Couchbase instance with index and query services and also create a bucket named “photogallery” with a primary index created on it. If I were to use the base Couchbase Docker image, all the steps mentioned above would have to be set up manually. One of the advantages of using Docker is that you can extend from a base image and do all sorts of automation steps as per your needs. This is achieved by the script (configure.sh) mentioned above. Once the image is up and running, you get a Couchbase instance with index and query service already up and running, and a bucket in place with an index placed on it.

The script sets up the Couchbase service, creates the bucket and the index all at one go.

The image can be created using:

Once the image is built, run it using:

At this point, you can log into the Couchbase Docker container by going to: is the Docker machine IP.

pasted image 0 2

Run the App Image

Once the Couchbase container is up and running, we can proceed to building the app container. Please check out the Dockerfile for the photogallery app for reference.

You can build the app container by:

Run the image by:

Now, if you type in the browser, you should see

pasted image 0 9

Test it out:

pasted image 0 4

The car image is saved and tagged. It has 4 “likes.” Let’s see the Couchbase bucket:

pasted image 0 7

As expected, the bucket has the updated information with 4 “likes” and the tags.

So, we have managed to run the photogallery app in a Docker container talking to another container (Couchbase) without installing anything on the local machine. Isn’t it cool?


The following posts from Nic Raboy are very helpful to get going with Docker and Node.js.


  • Build a photogallery app with auto tagging using AWS Rekognition and Couchbase – Part 1
  • Build a photogallery app with auto tagging using AWS Rekognition and Couchbase – Part 2
  • Build a photogallery app with auto tagging using AWS Rekognition and Couchbase – Part 3

This post is part of the Couchbase Community Writing Program


Posted by Laura Czajkowski, Developer Community Manager, Couchbase

Laura Czajkowski is the Snr. Developer Community Manager at Couchbase overseeing the community. She’s responsible for our monthly developer newsletter.

Leave a reply