Docker Community Forums

Share and learn in the Docker community.

How to expose it to the world on port 5984 and use your current directory as the CouchDB Database directory

(Srikar1996) #1

docker run -d -p 5984:5984 -v $(pwd):/usr/local/var/lib/couchdb --name couchdb apache/couchdb:1.7.1
.when i run the above command it is showing error like.
docker: Error response from daemon: Conflict. The container name “/couchdb” is already in use by container “3f333d4d275b2a4d3297c6cfedb8060ad4686850b660dd640eb63e44c8162810”. You have to remove (or rename) that container to be able to reuse that name.
problem is,i have only one container which has couchdb image,so when iam renaming this,it is asking for change in port again.

(Sam) #2

image and container are two different things…

if you do docker run -d and it fails or is termianted, the container still exists.

docker ps -a 
will show ALL the containers defined NOW..
docker ps 
will show only the containers RUNNING NOW

to remove a container you don’t want

docker rm container_id (or name if it has one)

this does not touch images.

you used couchdb as the containers name

if u don’t need to save or restart a container, you can add the -rm parm to the docker run, and it will be deleted when it stops running

just fyi, to remove and image you no longer need

docker rmi image_tag

to list images

docker images

(Srikar1996) #3

When i’am trying to use the running instance from an application with cmd
$ docker run --name my-couchdb-app --link my-couchdb:couch couchd

i’am getting below error loop,can u please help me out with list of commands for docker couchdb_setup

info] 2018-01-25T11:06:40.866557Z nonode@nohost <0.201.0> -------- open_result error {not_found,no_db_file} for _dbs
[warning] 2018-01-25T11:06:40.866607Z nonode@nohost <0.290.0> -------- creating missing database: _dbs
[warning] 2018-01-25T11:06:40.866640Z nonode@nohost <0.289.0> -------- creating missing database: _dbs
[info] 2018-01-25T11:06:40.881272Z nonode@nohost <0.7.0> -------- Application mem3 started on node nonode@nohost
[info] 2018-01-25T11:06:40.881510Z nonode@nohost <0.7.0> -------- Application fabric started on node nonode@nohost
[info] 2018-01-25T11:06:40.898809Z nonode@nohost <0.7.0> -------- Application chttpd started on node nonode@nohost
[error] 2018-01-25T11:06:40.926430Z nonode@nohost emulator -------- Error in process <0.327.0> with exit value: {database_does_not_exist,[{mem3_shards,load_shards_from_db,"_users",[{file,“src/mem3_shards.erl”},{line,403}]},{mem3_shards,load_shards_from_disk,1,[{file,“src/mem3_shards.erl”},{line,378}]},{mem3_shards,load_shards_from_disk…
[notice] 2018-01-25T11:06:40.926573Z nonode@nohost <0.326.0> -------- chttpd_auth_cache changes listener died database_does_not_exist at mem3_shards:load_shards_from_db/6(line:403) <= mem3_shards:load_shards_from_disk/1(line:378) <= mem3_shards:load_shards_from_disk/2(line:407) <= mem3_shards:for_docid/3(line:91) <= fabric_doc_open:go/3(line:38) <= chttpd_auth_cache:ensure_auth_ddoc_exists/2(line:187) <= chttpd_auth_cache:listen_for_changes/1(line:134)