CouchDB Docker image for RaspberryPi 2
A Dockerfile that produces a Docker image for Apache CouchDB
on the ARMv7 architecture.
It is based on the Ferran Rodenas's version
but includes the following changes and improvements:
- adds sample CORS configuration to CouchDB,
- runs everything as user
- uses CouchDB 1.6.1,
- is based on Debian Wheezy,
- its Docker image is smaller.
The Dockerfile is available on GitHub
master branch currently hosts CouchDB 1.6.1.
Build the image
To create the image, execute the following command on the
$ docker build -t kobretti/couchdb-cors .
Create Docker container from image
To run the image and bind to host port 5984:
$ docker run -d --name couchdb -p 5984:5984 kobretti/couchdb-cors
Admin user with random password
If you set the
COUCHDB_USERNAME environment variable via the
-e flag to the command above,
a new user with all privileges will be created. The password will be randomly generated.
To get the password, check the logs of the container by running:
docker logs <CONTAINER_ID>
You should see an output like the following:
======================================================== CouchDB User: "couchdb" CouchDB Password: "jPp5fBJySeuJPTN8" ========================================================
If you want to preset credentials, you can also specify the
variable. Please note, the
COUCHDB_USERNAME variable is required in this scenario, e.g.:
$ docker run -d \ --name couchdb \ -p 5984:5984 \ -e COUCHDB_USERNAME=myusername \ -e COUCHDB_PASSWORD=mypassword \ kobretti/couchdb-cors
No admin user
COUCHDB_PASSWORD are set when you create a container,
the administrator account will not be created.
If you want to create a database at container's boot time, you can set the
environment variable. The database is going to be created even if the credentials have not been set.
In this example we will preset our custom username and password and we will create a database:
$ docker run -d \ --name couchdb \ -P \ -e COUCHDB_USERNAME=myusername \ -e COUCHDB_PASSWORD=mypassword \ -e COUCHDB_DBNAME=mydb \ kobretti/couchdb-cors
The CouchDB server is configured to store data in the
inside the container. You can map this path to a volume on the host so the data becomes
independent of the running container:
$ mkdir -p /tmp/couchdb $ docker run -d \ --name couchdb \ -p 5984:5984 \ -v /tmp/couchdb:/usr/local/var/lib/couchdb \ kobretti/couchdb-cors
Copyright (c) 2014 Ferran Rodenas, 2015 Krzysztof Kobrzak. See LICENCE for details.