在Docker中自动执行couchbaseconfiguration

我在docker和couchbase上是很新的。 我想在couchbase中进行一些初始configuration。 我用这个脚本来设置pipe理员用户名和密码(所有行都一样) https://github.com/madhur/couchbase-docker/blob/master/couchbase/configure-node.sh

当我去localhost:8091我没有loginusername=Administrator -d password=password就像在configure-node.sh。 但是我可以loginusername=Administrator -d password=123456我设置这个用户名和密码,当我运行我的应用程序。 现在我删除了couchbase图像,我试图login新密码,但我没有。 为什么仍然旧的密码是有效的,我不能login新?

这里是我所有的Dockerfile内容:

 FROM couchbase/server COPY configure-node.sh /opt/couchbase CMD ["/opt/couchbase/configure-node.sh"] 

这里是我添加的docker-compose.yml相关部分:

 couchbase-db: build: couchbase/couchbase-conf 

所以我只做了这些改变。

当我运行docker-compose up -d couchbase-db我正在使用这个:

 Creating network "dev_default" with the default driver Building couchbase-db Step 1 : FROM couchbase/server latest: Pulling from couchbase/server 6c953ac5d795: Already exists 3eed5ff20a90: Already exists f8419ea7c1b5: Already exists 51900bc9e720: Already exists a3ed95caeb02: Already exists d2b32431ebaf: Already exists 6df065d46e65: Already exists 35c916dbd640: Already exists ef4d6b32517b: Already exists ac899008ccff: Already exists a38e2a84ca14: Already exists 009f47caeb08: Already exists 8567214b778f: Already exists Digest: sha256:72ed5cb40465e65c8d9cbf22a0dedc081ae0453e5b121ae4618c7436c70478c7 Status: Downloaded newer image for couchbase/server:latest ---> 97d69bb5e7f4 Step 2 : COPY configure-node.sh /opt/couchbase ---> beaa25387e4e Removing intermediate container f1352ae8478a Step 3 : CMD /opt/couchbase/configure-node.sh ---> Running in be5614f4702d ---> 0354f9e07af7 Removing intermediate container be5614f4702d Successfully built 0354f9e07af7 WARNING: Image for service couchbase-db was built because it did not already exist.To rebuild this image you must use `docker-compose build` or `docker-compose up --build`. Creating dev_couchbase-db_1 

然后,我正在查找couchbase日志:docker docker-compose logs -f couchbase-db 。 我得到这个:

 Attaching to dev_couchbase-db_1 couchbase-db_1 | Starting Couchbase Server -- Web UI available at http://<ip>:8091 couchbase-db_1 | {error_logger,{{2016,8,18}, {19,15,49}},"global_trace:~n~p",[{loop_the_locker,{multi,[],[], [],'nonode@nohost',false,false}}]} couchbase-db_1 | * Trying 127.0.0.1... couchbase-db_1 | % Total % Received % Xferd Average Speed Time Time Time Current couchbase-db_1 | Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- - -:--:-- 0* Connected to 127.0.0.1 (127.0.0.1) port 8091 (#0) couchbase-db_1 | > POST /pools/default HTTP/1.1 couchbase-db_1 | > User-Agent: curl/7.40.0-DEV couchbase-db_1 | > Host: 127.0.0.1:8091 couchbase-db_1 | > Accept: */* couchbase-db_1 | > Content-Length: 36 couchbase-db_1 | > Content-Type: application/x-www-form-urlencoded couchbase-db_1 | > couchbase-db_1 | } [36 bytes data] couchbase-db_1 | * upload completely sent off: 36 out of 36 bytes couchbase-db_1 | < HTTP/1.1 401 Unauthorized couchbase-db_1 | < WWW-Authenticate: Basic realm="Couchbase Server Admin / REST" couchbase-db_1 | < Server: Couchbase Server couchbase-db_1 | < Pragma: no-cache couchbase-db_1 | < Date: Thu, 18 Aug 2016 19:16:48 GMT couchbase-db_1 | < Content-Length: 0 couchbase-db_1 | < Cache-Control: no-cache couchbase-db_1 | < 100 36 0 0 100 36 0 30252 --:--:-- --:--:-- - -:--:-- 36000 couchbase-db_1 | * Connection #0 to host 127.0.0.1 left intact couchbase-db_1 | * Trying 127.0.0.1... couchbase-db_1 | % Total % Received % Xferd Average Speed Time Time Time Current couchbase-db_1 | Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- - -:--:-- 0* Connected to 127.0.0.1 (127.0.0.1) port 8091 (#0) couchbase-db_1 | > POST /node/controller/setupServices HTTP/1.1 couchbase-db_1 | > User-Agent: curl/7.40.0-DEV couchbase-db_1 | > Host: 127.0.0.1:8091 couchbase-db_1 | > Accept: */* couchbase-db_1 | > Content-Length: 26 couchbase-db_1 | > Content-Type: application/x-www-form-urlencoded couchbase-db_1 | > couchbase-db_1 | } [26 bytes data] couchbase-db_1 | * upload completely sent off: 26 out of 26 bytes couchbase-db_1 | < HTTP/1.1 401 Unauthorized couchbase-db_1 | < WWW-Authenticate: Basic realm="Couchbase Server Admin / REST" couchbase-db_1 | < Server: Couchbase Server couchbase-db_1 | < Pragma: no-cache couchbase-db_1 | < Date: Thu, 18 Aug 2016 19:16:48 GMT couchbase-db_1 | < Content-Length: 0 couchbase-db_1 | < Cache-Control: no-cache couchbase-db_1 | < 100 26 0 0 100 26 0 20967 --:--:-- --:--:-- - -:--:-- 26000 couchbase-db_1 | * Connection #0 to host 127.0.0.1 left intact couchbase-db_1 | * Trying 127.0.0.1... couchbase-db_1 | % Total % Received % Xferd Average Speed Time Time Time Current couchbase-db_1 | Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Connected to 127.0.0.1 (127.0.0.1) port 8091 (#0) couchbase-db_1 | > POST /settings/web HTTP/1.1 couchbase-db_1 | > User-Agent: curl/7.40.0-DEV couchbase-db_1 | > Host: 127.0.0.1:8091 couchbase-db_1 | > Accept: */* couchbase-db_1 | > Content-Length: 50 couchbase-db_1 | > Content-Type: application/x-www-form-urlencoded couchbase-db_1 | > couchbase-db_1 | } [50 bytes data] couchbase-db_1 | * upload completely sent off: 50 out of 50 bytes couchbase-db_1 | < HTTP/1.1 401 Unauthorized couchbase-db_1 | < WWW-Authenticate: Basic realm="Couchbase Server Admin / REST" couchbase-db_1 | < Server: Couchbase Server couchbase-db_1 | < Pragma: no-cache couchbase-db_1 | < Date: Thu, 18 Aug 2016 19:16:48 GMT couchbase-db_1 | < Content-Length: 0 couchbase-db_1 | < Cache-Control: no-cache couchbase-db_1 | < 100 50 0 0 100 50 0 19357 --:--:-- --:--:-- --:--:-- 25000 couchbase-db_1 | * Connection #0 to host 127.0.0.1 left intact couchbase-db_1 | % Total % Received % Xferd Average Speed Time Time Time Current couchbase-db_1 | Dload Upload Total Spent Left Speed 100 73 0 0 100 73 0 888 --:--:-- --:--:-- --:--:-- 901 couchbase-db_1 | % Total % Received % Xferd Average Speed Time Time Time Current couchbase-db_1 | Dload Upload Total Spent Left Speed 100 70 0 0 100 70 0 5943 --:--:-- --:--:-- --:--:-- 6363 couchbase-db_1 | % Total % Received % Xferd Average Speed Time Time Time Current couchbase-db_1 | Dload Upload Total Spent Left Speed 100 28 0 0 100 28 0 5261 --:--:-- --:--:-- --:--:-- 5600 couchbase-db_1 | HTTP/1.1 401 Unauthorized couchbase-db_1 | WWW-Authenticate: Basic realm="Couchbase Server Admin / REST" couchbase-db_1 | Server: Couchbase Server couchbase-db_1 | Pragma: no-cache couchbase-db_1 | Date: Thu, 18 Aug 2016 19:16:48 GMT couchbase-db_1 | Content-Length: 0 couchbase-db_1 | Cache-Control: no-cache couchbase-db_1 | couchbase-db_1 | Type: , Master: clause. In the asynchronous mode, CREATE PRIMARY INDEX starts a task to create the primary index and returns as soon as the task is queued for execution. The full inOUCHBASE_MASTER couchbase-db_1 | /entrypoint.sh couchbase-server 

这是我的项目文件夹结构部分相关的docker:

项目