0

我成功地将一个 couchdb 墨盒部署到 wso2stratos 并且成员成功激活。对于 dockerfile 的实现,我使用了这个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.htmlurl 并且它工作得很好。

我只是通过 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它们都不起作用。

有人能告诉我为什么我不能查看我的数据库并创建数据库窗口吗?

4

1 回答 1

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 命令是什么样子的,是不是暴露了端口?IE

docker run -p 8101:8101 ....

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

于 2014-09-29T19:13:20.210 回答