couchbase configuration on docker

偶尔善良 提交于 2020-05-29 10:40:47

问题


Hello I am very new on Docker and I want to make some initial configuration in the couchbase like that:

Create a bucket

Set admin password

I want to automate these two process. Because: When I first run couchbase-db on docker (docker-compose up -d couchbase db) I am going localhost:8091 and I am setting admin password. If I didnt do this when first running, I could not run couchbase properly.

What are ways to do this? Is there any images for doing this? Can I change Docker file for initial configuration?

Thanks.


回答1:


Running Couchbase inside Docker container is quite trivial. You just need to run below command and you are done. And, yes as you mentioned once below command is run just launch url and configure the Boubhbase through web console.

$sudo docker run -d --name cb1 couchbase

Above command runs Couchbase in detached mode (-d) and name is cb1.

I have provided more details about it on my blog, here.




回答2:


I have been searching myself and have struck gold, I'd like to share it here for the record.

There is indeed an image for what the OP seeks to do: pre-configure server when the container is created.

This method uses the Couchbase API in a custom image that runs this shell script to setup the server and any worker nodes, if needed. Here's an example to set credentials:

curl -v http://127.0.0.1:8091/settings/web -d port=8091 -d username=Administrator -d password=password

https://github.com/arun-gupta/docker-images/blob/master/couchbase/configure-node.sh

Here's how to use the image with docker-compose https://github.com/arun-gupta/docker-images/tree/master/couchbase

After the image is pulled, modify the configure-node.sh to fit your needs. Then run in single or in swarm mode.

Sources: https://blog.couchbase.com/couchbase-using-docker-compose/ https://docs.couchbase.com/server/4.0/rest-api/rest-bucket-create.html



来源:https://stackoverflow.com/questions/38993026/couchbase-configuration-on-docker

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!