Search code examples
dockerbindgraphdb

Docker GraphDB Container Not Starting with bind mount


I am trying to bind mount a directory to a GraphDB container, but the container exits (stops) immediately. If I remove the -v bind mount, I don't have this issue.

Example:

$ docker run -p 127.0.0.1:7200:7200 --name graphdb-one -t ontotext/graphdb:10.2.0 -v /home/eboraks/graphdb-import:/root/graphdb-import:ro

Output: GraphDB v10.2.0+sha.748abe32.

Without the -v it's working fine $ docker run -p 127.0.0.1:7200:7200 --name graphdb-one -t ontotext/graphdb:10.2.0

System:

  • Windows 10 with WSL2.
  • I am running the docker run from WSL

Solution

  • You need to put the -v option somewhere between run and the image name, otherwise its treated as arguments to the container's entrypoint, see here and here to learn more about the ENTRYPOINT and CMD instructions.

    So, to run GraphDB with a bind mount you need something like this:

    docker run -p 127.0.0.1:7200:7200 --name graphdb-one -t -v /home/eboraks/graphdb-import:/root/graphdb-import:ro ontotext/graphdb:10.2.0