We are using docker to automate the develop environments through docker compose. We use couchbase heavily in our applications. One problem we faced is that if you boot up the docker image of couchbase, you will have to manually perform the setup process, create buckets and so on. Performing all of these steps manually and everytime is time consuming and not at all ideal.
I will show you how we solved this problem and automated these steps through Dockerfile
The key thing here is that Couchbase exposes a set of services to perform each of the operation which can be invoked just after the server start.
We are using docker-compose and hence our docker-compose.yml is as follows:
Through build: couchbase/, I am pointing to a couchbase directory which contains our Dockerfile and a script configure-node.sh which invokes the REST API endpoints of couchbase.
Here is the very simplistic Dockerfile
We use the following script to configure the node.