I have a django webapp which stores data to couchdb table named “test”. dependency in django service is given as depends_on: couchserver.But django app terminates as it is unable to locate “test” table in couchdb. Below is the docker-compose.yml for couchdb (django is excluded here)
couchserver:
image: couchdb
command: curl -u rob:123456 -X PUT localhost:5984/test
ports:
- "5984:5984"
environment:
- COUCHDB_USER=rob
- COUCHDB_PASSWORD=123456
volumes:
- ./data:/opt/couchdb/data
command: curl -u rob:123456 -X PUT localhost:5984/test
would not work and throws error because couchdb container has not started. I want to create a table in couchdb before the django app starts. How can i achieve this using docker-compose.yml or any other alternatives.
I’m novice to docker, any help is really appreciated.
Complete code with question : https://stackoverflow.com/questions/63623075/how-to-run-commands-from-docker-compose-yml-to-start-couchdb#63624336