Building CouchDB 2.0 Docker image

Building CouchDB 2.0 Docker image


In this post we will create Docker image with CouchDB, that will be used to create node containers in the future. This image based on Debian Jessie Docker image and includes all required dependencies.

Create directories inside your workspace:
$ mkdir docker
$ mkdir couchdb2.0
 Go to created path
$ cd ./docker/couchdb2.0/
 Create Dockerfile
$ touch Dockerfile
Insert next configuration into ./Dockerfile using text editor
FROM debian:jessie
ENV DEBIAN_FRONTEND noninteractive

# Install dependencies
RUN apt-get -qq update
RUN apt-get --no-install-recommends -y install \
    build-essential pkg-config erlang \
    libicu-dev libmozjs185-dev libcurl4-openssl-dev \
    wget

# Download CouchDB source
WORKDIR /
RUN wget -nv http://apache.mirrors.spacedump.net/couchdb/source/2.0.0/apache-couchdb-2.0.0.tar.gz \
 && tar -xf apache-couchdb-2.0.0.tar.gz \  
 && rm apache-couchdb-2.0.0.tar.gz 

# Build CouchDB into /couchdb
WORKDIR /apache-couchdb-2.0.0
RUN ./configure && make release \
 && cp -r rel/couchdb /couchdb \
 && cd / \
 && rm -rf /apache-couchdb-2.0.0

# Setup CouchDB permissions and defaults
WORKDIR /couchdb
RUN sed -i'' 's/bind_address = 127.0.0.1/bind_address = 0.0.0.0/' etc/default.ini

# Range of ports that should be exposed, required if you will  
# map container ports to real networks

EXPOSE 5984 5986 4369 9100-9200
ENTRYPOINT ["/couchdb/bin/couchdb"]
Build your docker image
$ sudo docker build ./ -t couchdb20
Wait while dependencies will be installed and Docker finish building of your image. After long listing, if all OK, you should see message like this:
...
Successfully built 25a0a1522fcf
Check list of your Docker images, you should see image with same ID as in last message after building:
$ sudo docker images 
REPOSITORY     TAG              IMAGE ID            CREATED             SIZE
couchdb20      latest           25a0a1522fcf        17 minutes ago      624.5 MB

Comments

Popular Posts