Setup Apache CouchDB screen re-appears on containe

2019-08-01 09:12发布

问题:

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

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

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

What is going on here?

回答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.