# Startup error running Stardog 5.0.1 in Docker

**URL:** <https://community.stardog.com/t/startup-error-running-stardog-5-0-1-in-docker/461>\
**Category:** Support\
**Created:** [July 17, 2017, 3:42pm UTC](https://community.stardog.com/t/startup-error-running-stardog-5-0-1-in-docker/461 "2017-07-17T15:42:38Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![jontutcher](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/jontutcher/32/125_2.png) [@jontutcher](https://community.stardog.com/u/jontutcher)\
**Post date:** [July 17, 2017, 3:42pm UTC](https://community.stardog.com/t/startup-error-running-stardog-5-0-1-in-docker/461/1 "2017-07-17T15:42:38Z")

</div>

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:

```auto
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: [There was an error initializing Stardog; one or more dependencies could not be s - Pastebin.com](https://pastebin.com/DrR3fg05)

Steps to reproduce using Dockerfile:

1. Use this dockerfile: [stardog-dockerfile · GitHub](https://gist.github.com/jontutcher/e2af327d1edb28d2b77a9ebdab71385c) (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 `stardog-5.0.1.zip` 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/stardog-5.0.1.zip`
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:

```auto
java -Djava.io.tmpdir=/tmpdir -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 🙂

---

<div class="post-metadata">

**Author:** ![zachary.whitley](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/zachary.whitley/32/94_2.png) [@zachary.whitley](https://community.stardog.com/u/zachary.whitley)\
**Post date:** [July 17, 2017, 4:28pm UTC](https://community.stardog.com/t/startup-error-running-stardog-5-0-1-in-docker/461/2 "2017-07-17T16:28:33Z")

</div>

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

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

it should be

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

```

---

<div class="post-metadata">

**Author:** ![jontutcher](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/jontutcher/32/125_2.png) [@jontutcher](https://community.stardog.com/u/jontutcher)\
**Post date:** [July 17, 2017, 4:49pm UTC](https://community.stardog.com/t/startup-error-running-stardog-5-0-1-in-docker/461/3 "2017-07-17T16:49:07Z")

</div>

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.

Cheers,  
Jon

---

<div class="post-metadata">

**Author:** ![zachary.whitley](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/zachary.whitley/32/94_2.png) [@zachary.whitley](https://community.stardog.com/u/zachary.whitley)\
**Post date:** [July 17, 2017, 5:52pm UTC](https://community.stardog.com/t/startup-error-running-stardog-5-0-1-in-docker/461/4 "2017-07-17T17:52:20Z")

</div>

Try adding STARDOG=/stardog-5.0.1 to your ENV

---

<div class="post-metadata">

**Author:** ![jontutcher](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/jontutcher/32/125_2.png) [@jontutcher](https://community.stardog.com/u/jontutcher)\
**Post date:** [July 17, 2017, 8:10pm UTC](https://community.stardog.com/t/startup-error-running-stardog-5-0-1-in-docker/461/5 "2017-07-17T20:10:24Z")

</div>

> [@zachary.whitley](#):
>
> STARDOG=/stardog-5.0.1

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!

Cheers,  
Jon

---

<div class="post-metadata">

**Author:** ![pdmars](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/pdmars/32/17_2.png) [@pdmars](https://community.stardog.com/u/pdmars)\
**Post date:** [July 17, 2017, 8:34pm UTC](https://community.stardog.com/t/startup-error-running-stardog-5-0-1-in-docker/461/6 "2017-07-17T20:34:30Z")

</div>

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

Paul

---

<div class="post-metadata">

**Author:** ![zachary.whitley](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/zachary.whitley/32/94_2.png) [@zachary.whitley](https://community.stardog.com/u/zachary.whitley)\
**Post date:** [July 17, 2017, 8:52pm UTC](https://community.stardog.com/t/startup-error-running-stardog-5-0-1-in-docker/461/7 "2017-07-17T20:52:00Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![jontutcher](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/jontutcher/32/125_2.png) [@jontutcher](https://community.stardog.com/u/jontutcher)\
**Post date:** [July 18, 2017, 9:01am UTC](https://community.stardog.com/t/startup-error-running-stardog-5-0-1-in-docker/461/8 "2017-07-18T09:01:18Z")

</div>

@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!

---

<div class="post-metadata">

**Author:** ![zachary.whitley](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/zachary.whitley/32/94_2.png) [@zachary.whitley](https://community.stardog.com/u/zachary.whitley)\
**Post date:** [July 18, 2017, 10:02am UTC](https://community.stardog.com/t/startup-error-running-stardog-5-0-1-in-docker/461/9 "2017-07-18T10:02:04Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![pdmars](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/pdmars/32/17_2.png) [@pdmars](https://community.stardog.com/u/pdmars)\
**Post date:** [July 18, 2017, 1:02pm UTC](https://community.stardog.com/t/startup-error-running-stardog-5-0-1-in-docker/461/10 "2017-07-18T13:02:49Z")

</div>

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: [Home | Stardog Documentation Latest](https://www.stardog.com/docs/#_memory_management)

Paul

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)\
**Post date:** [August 1, 2017, 1:03pm UTC](https://community.stardog.com/t/startup-error-running-stardog-5-0-1-in-docker/461/11 "2017-08-01T13:03:03Z")

</div>

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