Couchdb cartridge not responding in docker image

361 Views Asked by At

I successfully deployed a couchdb cartridge to wso2stratos and member get activated successfully. For the implementation of the dockerfile i used this git code. which include the below line that i have no idea why it is there! Can someone explain the below code?

RUN printf "[httpd]\nport = 8101\nbind_address = 0.0.0.0" > /usr/local/etc/couchdb/local.d/docker.ini
EXPOSE 8101
CMD ["/usr/local/bin/couchdb"]

I tried pointing http://127.0.0.1:5984/_utils/spec/run.html url and its working perfectly.

I just SSH to the docker container and start the couchdb,

 root@instance-00000001:/usr/local/etc/couchdb/local.d# couchdb couchdb
Apache CouchDB 1.6.1 (LogLevel=info) is starting.
Apache CouchDB has started. Time to relax.
[info] [<0.32.0>] Apache CouchDB has started on http://0.0.0.0:8101/

Then I try to pointing the browser to http://0.0.0.0:8101/ and http://127.0.0.1:5984/_utils/index.html both of them not working.

Can someone tell me why i can't view my databases and create database window?

1

There are 1 best solutions below

0
Usman Ismail On BEST ANSWER

For your first question about what those lines do:

# Set port and address for couchdb to bind too.
# Remember these are addresses inside the container 
#    and not necessarily publicly available.
# See http://docs.couchdb.org/en/latest/config/http.html
RUN printf "[httpd]\nport = 8101\nbind_address = 0.0.0.0" >
      /usr/local/etc/couchdb/local.d/docker.ini


# Tell docker that this port needs to be exposed.
# You still need to run -P when running container
EXPOSE 8101

# This is the command which is run automatically when container is run
CMD ["/usr/local/bin/couchdb"]

As for why you cannot access it, What does your docker run command look like, did you expose the port? i.e.

docker run -p 8101:8101 ....

Are you by any chance testing on OSX? If so try http://192.168.59.103:8101/ On OSX docker would be inside a virtual box VM as docker cannot run natively on OSX. The IP of the virtual machine can be looked up using boot2docker ip and is normally 192.168.59.103.