I initialized grakn database through a docker-compose file like this:
grakn:
container_name: grakn
image: graknlabs/grakn:latest
networks:
- grakn-network
ports:
- "48555:48555"
volumes:
- grakndata:/grakn-core-all-linux/server/db
- ./schema:/schema
command: [sh, -c, "cd grakn-core-all-linux && ./grakn console --keyspace myopp --file /schema/schema.gql"]
However, I get a connection error due to the fact that grakn does not start both storage and server in time so that the script in "command" can execute successfully. Does anyone know how I can solve this issue? My objective is to have the database up and running with the schema "myopp" already loaded.
Thanks in advance :)
When you add command
in your service definition, existing command of the image (originally, grakn-docker.sh
) got replaced. Therefore, Grakn didn't start before you tried to load the schema. An easy way to fix it would be to start Grakn manually in your command, something like this:
command: [sh, -c, "cd grakn-core-all-linux && ./grakn server start && ./grakn console --keyspace myopp --file /schema/schema.gql"]