1

I have a schema script /data/cb-create.sh that I have made available on a container volume. When I run docker-compose up, my server is not initialized at the time command is executed. So those commands fail because the server isn't launched just yet. I do not see a Starting Couchbase Server -- Web UI available at http://<ip>:8091 log line when the .sh script is running to initialize the schema. This is my docker compose file. How can I sequence it properly?

version: '3'

services:
 couchbase:
    image: couchbase:community-6.0.0
    deploy:
      replicas: 1
    ports:
      - 8091:8091
      - 8092:8092
      - 8093:8093
      - 8094:8094
      - 11210:11210
    volumes:
      - ./:/data

    command: /bin/bash -c "/data/cb-create.sh"
    container_name: couchbase
 

volumes:
 kafka-data:

Sankalp
  • 1,182
  • 2
  • 17
  • 22

1 Answers1

1

First: You should choose either an entrypoint or a command statement. I guess an option is to write a small bash script where you put these commands in order. Then in the command you specify running that bash script.

Chai
  • 1,796
  • 2
  • 18
  • 31
  • I already have `command` section in my docker-compose file in which I am invoking that cb-create.sh bash script. – Sankalp Jun 23 '21 at 17:52
  • You can not have a entrypoint and a command. So whatever is in the entrypoint should be in that bash script too. – Chai Jun 23 '21 at 21:42