Skip to main content
Set up CouchDB using self-signed, locally issued certificates and test that it accepts TLS connections, enforces authentication, and allows secure read/write operations from a test client.
For production purposes, we recommend using publicly trusted certificates issued by a Certificate Authority (CA).

Components

  • CouchDB image built by Minimus: CouchDB listens only on HTTPS (5984); HTTP is disabled.
  • Dynamic certificate generation via OpenSSL:
    • certgen.sh script: Shell script that generates a custom CA, server, and client certificates using OpenSSL.
    • minidebug image: A Minimus dev toolkit that provides a shell, OpenSSL, and other utilities used to generate the certificates.
The test does not persist any certificates on the host machine.

What this guide demonstrates

  • TLS handshake validation
  • Server/client certificate trust
  • Basic auth and CouchDB operations

Directory structure

Deploy CouchDB with self-signed TLS certificates

Step 1: Generate TLS certificates

1

Save script that generates TLS certificates

Save the following script to a file named certgen.sh. The script is used to generate the TLS certificates and store them in a certs folder on the host.
certgen.sh
2

Save Docker Compose configuration

Save the following YAML configuration to a file named create-certs.yml. The configuration uses the Minimus minidebug image to generate the certificates with the certgen.sh shell script. Minidebug is a secure Minimus dev toolkit that provides a shell, OpenSSL, and other utilities.The certificates will be persisted in the certs volume on the host.
create-certs.yml
3

Generate certificates

Run the following to generate the certificates:
Congrats! You have just generated the following self-signed certificates:
  • CA certificate (ca.pem)
  • Server certificates (server-cert.pem, server-key.pem)
  • Client certificates (client.pem, client-key.pem)
In the next steps, you will mount these certificates into the CouchDB container and configure them via local.ini.

Step 2: Deploy CouchDB server

1

Save couchdb-local.ini

Save the following configuration to a file named couchdb-local.ini:
couchdb-local.ini
2

Save Docker Compose script

Save the following Docker Compose script to docker-compose.yml. This compose file sets up CouchDB using TLS (HTTPS only), with authentication enabled, mounts the generated certificates, uses the configurations in the local INI file, and exposes CouchDB over https://localhost:15984.
docker-compose.yml
If you don’t yet have the folder ./data ready and waiting, create it and give it permissions:
3

Run CouchDB

Start the CouchDB container:

Step 3: Test your CouchDB server

Connect to your database and test its connectivity. For example, here are a few commands you can try out:
  1. Check server health:
    You should get the response {"seeds":{},"status":"ok"}.
  2. Create and delete a database (for example testdb):
  3. List all databases:
    You can also pass the request for a JSON format. This option requires the jq JSON processor.
  4. Check if a database exists:
  5. Create document:
Last modified on July 12, 2026