We have different ways to connect couchdb in docker containers
>>> Using docker compose:
Step1:
create file docker-compose.yml::
version: '3'
services:
couchserver:
image: couchdb
restart: always
ports:
- "5984:5984"
environment:
- COUCHDB_USER=admin
- COUCHDB_PASSWORD=admin
volumes:
- ./dbdata:/opt/couchdb/data
Step2:
From the directory that contains your docker-compose.yml file, run:
docker-compose up -d
Step3:
Docker will pull your image and setup everything for you.
Soon as everything set, make sure your CouchDB container is up and running, but the following command:
docker ps
Step4:
Access CouchDB admin
In order to validate your working CouchDB install, head to http://localhost:5984/.
To access the CouchDB admin, head to http://localhost:5984/_utils/
=========================================
>>> Using Docker command:
Step1:
docker run -itd -p 25984:5984 -p 25986:5986 --name=couchdb2 \
-e NODENAME='couchdb-2.local.com' \
--mount 'source=volume-2,target=/opt/couchdb/data' \
couchdb:2.3.0
Step2:
curl -X GET http://localhost:25984
References:
https://medevel.com/tutorial-install-couchdb-with-docker/
https://medium.com/@singinjon/cluster-couchdb-2-and-docker-on-localhost-f0490649d960
No comments:
Post a Comment
I'm certainly not an expert, but I'll try my hardest to explain what I do know and research what I don't know.