Couchdb磁带在docker镜像中没有响应

时间:2014-09-29 13:29:15

标签: couchdb docker openstack paas wso2stratos

我成功地将一个couchdb盒式磁带部署到wso2stratos并成功激活了成员。为了实现dockerfile,我使用了this git代码。其中包括以下行,我不知道它为什么存在!有人可以解释下面的代码吗?

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"]

我尝试指向http://127.0.0.1:5984/_utils/spec/run.html网址并完美运行。

我只是SSH到docker容器并启动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/

然后我尝试将浏览器指向http://0.0.0.0:8101/http://127.0.0.1:5984/_utils/index.html两者都不起作用。

有人可以告诉我为什么我无法查看我的数据库并创建数据库窗口吗?

1 个答案:

答案 0 :(得分:3)

关于这些线路的第一个问题:

# 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"]

至于为什么你无法访问它,你的docker run命令是什么样的,你暴露了端口吗?即。

docker run -p 8101:8101 ....

您是否有机会在OSX上进行测试?如果是这样,请尝试http://192.168.59.103:8101/在OSX上,docker将位于虚拟机框VM中,因为docker无法在OSX上本机运行。可以使用boot2docker ip查找虚拟机的IP,通常是192.168.59.103