Startup error running Stardog 5.0.1 in Docker

Apologies if I’m missing something obvious. I’ve been trying to create a docker image for Stardog 5.0.1, and am running into a segfault error when I try to start it up:

There was an error initializing Stardog; one or more dependencies could not be satisfied. Please verify your classpath is correct.
The initialization errors were:
 *	Error in custom provider, java.lang.RuntimeException: Could not load system index: system

Full stack trace here:

Steps to reproduce using Dockerfile:

  1. Use this dockerfile: (also tested with a base ubuntu image and OpenJDK install steps
  2. docker build -t stardog .
  3. docker run -d --name stardog_instance stardog

Steps to reproduce manually, from an ubuntu base image

  1. Put and stardog-license-key.bin in resources directory on host machine, then reference as a volume (as below)
  2. docker run -it --name=stardog_test -v $(pwd)/resources:/resources ubuntu bash
  3. apt-get update && apt-get install -y unzip openjdk-8-jre
  4. cd / && unzip /resources/
  5. mkdir /stardog-data
  6. export STARDOG_HOME=/stardog-data
  7. cp /resources/stardog-license-key.bin /stardog-data
  8. /stardog-5.0.1/bin/stardog-admin server start [edited to correct typo]

The command the stardog-admin bash script is executing, which bugs out, is:

java -Dstardog.home=/stardog-data/ -XX:SoftRefLRUPolicyMSPerMB=1 -XX:+UseParallelOldGC -XX:+UseCompressedOops -Djavax.xml.datatype.DatatypeFactory=org.apache.xerces.jaxp.datatype.DatatypeFactoryImpl -Dapple.awt.UIElement=true -Dfile.encoding=UTF-8 -Dlog4j.configurationFile=/stardog/bin/../server/dbms/log4j2.xml -Dstardog.install.location=/stardog/bin/.. -server -classpath '/stardog/bin/../client/ext/*:/stardog/bin/../client/api/*:/stardog/bin/../client/cli/*:/stardog/bin/../client/http/*:/stardog/bin/../client/snarl/*:/stardog/bin/../client/pack/*:/stardog/bin/../server/ext/*:/stardog/bin/../server/dbms/*:/stardog/bin/../server/http/*:/stardog/bin/../server/snarl/*:/stardog/bin/../server/pack/*:/*' com.complexible.stardog.cli.admin.CLI server start

I’m running Docker 17.06.0-ce-mac19 (18663) stable, on a 2017 Macbook Pro…

Does anyone have any suggestions? I’m not wedded to using Ubuntu as a base image - anything for a working version would be fine!

Everything works perfectly on ‘bare’ macos :slight_smile:

1 Like

It looks like you’re referencing the Stardog distro as a .tar.gz file when it should be .zip

ADD resources/stardog-${STARDOG_VER}.tar.gz /

Step 8. Has two additional dashes that shouldn’t be there


it should be

/stardog-5.0.1/bin/stardog-admin server start

Thanks for your reply!

The ADD step references a tarred/gzipped version of the stardog zip to make it easier for Docker - ADD automatically extracts tar files but not zips. That command can be replaced with the ADD resources/stardog-${STARDOG_VER}.zip followed by an unzip command to produce the same behaviour.

The step 8 stardog-admin-server-start was my typo in my post - running the corrected command gives the error I showed.


Try adding STARDOG=/stardog-5.0.1 to your ENV

Thanks - unfortunately that makes no difference - get exactly the same error as before. Have tried it as an ENV line in the Dockerfile, and doing export STARDOG=/stardog-5.0.1 manually. I’ll have a go at replicating it on another machine in the morning!


You can try increasing the amount of memory available to Docker for Mac (in Docker Preferences -> Advanced) and see if that helps.


Now that I’m looking at it that won’t make any difference. For anyone following $STARDOG_HOME is where the db files and license will be located. $STARDOG gets set under the hood to where the Stardog installation actually is. If you don’t set it $STARDOG will be set based on the location of the stardog-admin command. You were executing the script with the full path and I thought something might have been getting messed up there causing classpath issues. You’d have to set $STARDOG if for some reason you relocated the stardog-admin command to some place like /usr/bin

Is there a possibility that you didn’t get everything when you went to make your tarball?

@pdmars That worked, thanks! Is there a way of telling Stardog / the JVM how much memory to use? I tried -Xmx1536m to try and limit the JVM to 1.5GB (inside a max for docker of 2GB) but it didn’t seem to work. The fact it’s working now is great, it’d just be nice if I could make it more predictable.

@zachary.whitley I’ll leave $STARDOG set anyway in case I end up symlinking the stardog-adming command somewhere. Thanks for your help too!

You can set Stardog memory allocation by setting STARDOG_JAVA_ARGS. By default it’s set to

STARDOG_JAVA_ARGS="-Xmx2g -Xms2g -XX:MaxDirectMemorySize=1g"

I believe that you should be fine without setting STARDOG even if you symlinked it. You’d only really need it if you moved it.

Great, I’m glad that worked! Beyond adjusting those STARDOG_JAVA_ARGS the documentation also has a good section on memory management and how you might want to adjust those settings based on your requirements:


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.