Unable to get Couchbase to run in docker

Hi,

I’ve tried these tutorials on docker:

But when I go to run the image and do a “docker ps -a”, I see the following status:
“/entrypoint.sh /opt…” 2 seconds ago Exited (1) 10 seconds ago

I need someone’s help with making sure that my configuration is working properly.

1 Like

Hi Adrian,

Are you having problems with the standard Couchbase image, or a custom one? If a custom one, can you post your configuration?

Also, can you post the full text of the status? And did you make configure.sh executable before building your docker image? (That’s one small issue I hit while reproducing the steps in the first blog you referenced.)

hi @hod.greeley,

Here’s the config in my Dockerfile:

FROM couchbase:community-5.1.1
COPY configure.sh /opt/couchbase
CMD ["/opt/couchbase/configure.sh"]

And this is what’s in my confgure.sh:

set -m

/entrypoint.sh couchbase-server &

sleep 15

curl -v -X POST http://127.0.0.1:8091/pools/default -d memoryQuota=512 -d indexMemoryQuota=512

curl -v http://127.0.0.1:8091/node/controller/setupServices -d services=kv%2cn1ql%2Cindex

curl -v http://127.0.0.1:8091/settings/web -d port=8091 -d username=$COUCHBASE_ADMINISTRATOR_USERNAME -d password=$COUCHBASE_ADMINISTRATOR_PASSWORD

curl -i -u $COUCHBASE_ADMINISTRATOR_USERNAME:$COUCHBASE_ADMINISTRATOR_PASSWORD -X POST http://127.0.0.1:8091/settings/indexes -d 'storageMode=memory_optimized'

curl -v -u $COUCHBASE_ADMINISTRATOR_USERNAME:$COUCHBASE_ADMINISTRATOR_PASSWORD -X POST http://127.0.0.1:8091/pools/default/buckets -d name=$COUCHBASE_BUCKET -d bucketType=couchbase -d ramQuotaMB=128 -d authType=sasl -d saslPassword=$COUCHBASE_BUCKET_PASSWORD

fg 1

I noticed an issue in this post, Using Couchbase With Docker And Deploying A Containerized NoSQL Cluster with:

–network=“docker_default” \

But in the video, Nic corrects the issue.

1 Like

Here’s the run command that I’m using:

docker run -d \
    -p 8091-8093:8091-8093 \
    -e COUCHBASE_ADMINISTRATOR_USERNAME=Administrator \
    -e COUCHBASE_ADMINISTRATOR_PASSWORD=password \
    -e COUCHBASE_BUCKET=default \
    -e COUCHBASE_BUCKET_PASSWORD= \
    --network="bridge" \
    --name couchbaseDB myCouchImage

Here’s full status:

CONTAINER ID        IMAGE                 COMMAND                  CREATED             STATUS                      PORTS               NAMES
f4142623a6e7        myCouchImage   "/entrypoint.sh /opt…"   15 seconds ago      Exited (1) 13 seconds ago                       couchbaseDB

@hod.greeley,

The issue is with the code in the configure.sh. When I removed the reference to the file in Dockerfile, I’m able to run the container.

I suspect, the problem is with this statement:

/entrypoint.sh couchbase-server &

Yes, Nic used a technique of putting server in the background while the configuration (curl) steps run. Then moving server to the foreground (fg 1). He has all the configuration built into the docker script itself. I believe he found some issues with older versions of docker.

He has that 15 second pause hardcoded. I wonder if that’s causing your problem. That’s just a guess at how long to wait for Couchbase to be ready.

I used a different approach. You can see it in in this code https://github.com/couchbaselabs/connect-fall-2017-demo and described in this post https://blog.couchbase.com/simplified-couchbase-server-cluster-creation-via-docker/

I finally got a chance to resolve the problem. The issue was with the execution permission with configure.sh.

@nraboy video explains the issue and how to fix it with

chmod +x configure.sh

1 Like