3

I have CouchDB v2.3 running using the official Docker image. I've configured the database as a Single Node using Fauxton.

The /data directory is mount to a local directory. When I'm restarting the container, the databases are still there. So the volume binding works as expected.

Now, everytime I'm restarting the container and I navigate to the 'Setup' tab, it looks like CouchDB did not remember I've configured it as a Single Node.

I keep seeing the following screen after restarting the image enter image description here

Once I've configured it again, I see the following screen

enter image description here

Until I reboot the container. Then I have to the first screen again.

What is going on here?

ndequeker
  • 7,932
  • 7
  • 61
  • 93
  • Refer https://stackoverflow.com/a/54523511/2031560 – Nest Feb 21 '19 at 11:28
  • I'm not sure if I get that. The volume is re-mounted, as the databases are still available after restarting the Docker container. – ndequeker Feb 21 '19 at 11:45
  • I have this issue as well. Persistance of the dockers /opt/couchdb/data works without issue, and data is retained, but somehow admin users and actual couchDB setup is not. I.e. probably stored somewhere else.. – D.S Jan 07 '20 at 18:49
  • I'm quite sure that the heading named "Using a persistent CouchDB configuration file" on the dockerhub page for couchdb solves this. Now for why your copied file did not, I have no clue. – D.S Jan 07 '20 at 19:01
  • Similar issue here with couchdb v3. No solution for me yet :( https://github.com/apache/couchdb/issues/3257 – willem Nov 10 '20 at 13:53

1 Answers1

1

I was using the wrong CouchDB configuration file path to apply my own configuration.

Non-working example (Dockerfile)

FROM couchdb:2.3
COPY local.ini /opt/couchdb/etc/local.d/docker.ini

Working example (Dockerfile)

FROM couchdb:2.3.0
COPY local.ini /opt/couchdb/etc/local.ini

local.ini

To make sure the cluster should not be re-configured when the Docker container is being re-started, I've also put the configuration inside the local.ini file.

; CouchDB Configuration Settings

; Custom settings should be made in this file. They will override settings
; in default.ini, but unlike changes made to default.ini, this file won't be
; overwritten on server upgrade.

[chttpd]
port = 5984
bind_address = 0.0.0.0

; To create an admin account uncomment the '[admins]' section below and add a
; line in the format 'username = password'. When you next start CouchDB, it
; will change the password to a hash (so that your passwords don't linger
; around in plain-text files). You can add more admin accounts with more
; 'username = password' lines. Don't forget to restart CouchDB after
; changing this.
[admins]
admin = ******

[cluster]
n = 1

I'm not yet sure why my initial configuration copied to /opt/couchdb/etc/local.d/docker.ini wasn't working before.

ndequeker
  • 7,932
  • 7
  • 61
  • 93