This is a Dockerfile and supporting scripts for running Couchbase Server in a Docker container.
Originally a personal research project, this project has been superseded by official Docker related resources described below.
NOTE You might want to consider these alternative projects:
- Couchbase Docker image on dockerhub
- Dockerfiles and configuration scripts for the Docker Hub Official Couchbase images
- Run Couchbase Server under Docker + Kubernetes
- Run Couchbase Server under Docker + CoreOS
Some preparation of the host operating system running the Docker daemon is required prior to launching Docker containers. The exact preparation steps differ depending on the OS distribution.
Note about open file limits and locked memory: You'll need to increase the number of open files and locked memory available to Couchbase Server containers on the Docker host.
To do so, first access a shell on the host machine and create the docker
daemon initialization file, /etc/init/docker.conf
:
sudo $EDITOR /etc/init/docker.conf
Then add the following lines to the file:
limit memlock unlimited unlimited
limit nofile 262144 262144
You'll need to restart the Docker daemon after making the above changes. These changes will affect the Docker daemon and all of its child processes, including containers.
This project will not be supporting CoreOS in its current form.
Now, you can run a Couchbase Server Docker container.
If you have not already, clone this project repository to your Docker host:
git clone https://github.com/brianshumate/docker-couchbase-server.git
Then, use the following commands to run a container based on this project:
cd docker-couchbase-server
INT=`ip route | awk '/^default/ { print $5 }'`
ADDR=`ip route | egrep "^[0-9].*$INT" | awk '{ print $9 }'`
exec sudo docker run -i -d -t -e DOCKER_EXT_ADDR=$ADDR \
-e "SERVICE_NAME=couchbase-server" -e "SERVICE_TAGS=couchbase" \
-v /home/core/data/couchbase:/opt/couchbase/var \
-p 11210:11210 -p 8091:7081 -p 8092:8092 \
jbs_cb:dockerfile
If your Docker host is running CoreOS, use the included coreos.script
:
cd docker-couchbase-server
exec sudo ./bin/coreos.script
You can also get a 3 node cluster going with the included
multi-node-cluster
script:
cd docker-couchbase-server
exec sudo ./bin/multi-node-cluster
Docker is nativelt supported on macOS. To learn more about official Docker macOS support, consult the Docker for Mac documentation.
Build the Dockerfile
:
git clone https://github.com/brianshumate/docker-couchbase-server
cd docker-couchbase-server
docker build -t "brianshumate_cb:dockerfile" .
Run it (optionally with SERVICE_NAME
and SERVICE_TAGS
for Consul:
docker run -i -d -t -v $HOME/tmp/couchbase:/opt/couchbase/var \
-e "SERVICE_NAME=couchbase-server" -e "SERVICE_TAGS=couchbase" \
-p 11210:11210 -p 8091:7081 -p 8092:8092 \
--rm brianshumate_cb:dockerfile
The following are some additional handy resources related to operating Couchbase Server in a Docker environment:
- Run Couchbase Server under Docker + CoreOS
- Dockerfiles and configuration scripts for the Docker Hub Official Couchbase images
- Running Couchbase Cluster Under CoreOS on AWS
- How I built couchbase 2.2 for docker
- Couchbase Server / Docker Index
- Running Couchbase Cluster Under Docker
- Couchbase Docker container