Link Search Menu Expand Document
Start for Free

Use Docker

This page describes how to run Stardog via Docker.


To run Stardog via Docker please use the following steps:

  1. Install Docker

  2. Confirm that the docker daemon is running in the background.

     docker version
    

    If you do not see the server listed, start the Docker daemon.

  3. The latest release of Stardog is available on Docker Hub. You can pull the image from Docker Hub with:

     docker pull stardog/stardog:latest
    

    To verify the signature of the Stardog image, see verifying the signature.

    • The STARDOG_HOME directory is located in /var/opt/stardog/ in the Docker image. This is the directory where all the Stardog databases and other files will be stored.
  4. Start the Stardog server

    Some Docker volume drivers do not respect Stardog’s lock file which may cause data loss if two Stardogs use the same $STARDOG_HOME. Please see the Administering Stardog 101 section for more details.

    Because stardog-admin server start (the command to start up the Stardog server) is the entry point for the Docker image, you must instruct Docker to mount a home directory with a valid license from your host machine at /var/opt/stardog in the image. For example:

     docker run -it -v ~/stardog-home/:/var/opt/stardog -p 5820:5820 stardog/stardog
    
    • In this example, ~/stardog-home/ is a Stardog home directory on the host machine that only contains a Stardog license file. /var/opt/stardog is the location of Stardog home in the Docker image. If you do not have a license file, you can obtain one by speaking with a Stardog sales representative. If you do not want to manage your own Stardog license, you can simply sign up for a free account with Stardog Cloud.
      • The commands on this page assume the host machine has a UNIX based operating system. If you are running Docker on Windows be sure to specify a Windows-style path to the directory you want to mount to the container.

      If you use selinux, you may need some additional configuration when mounting a directory to the container. See the Docker docs for more information.

    • The contents of the distribution (binaries, docs, helm charts) are located in /opt/stardog/.

    • Note, the -p option to map port 5820 on the container (the default Stardog port) to port 5820 on localhost for easy communication with the server.

    • If you need to load in external jars (e.g., for virtual graph JDBC drivers or custom function), you will need to both specify an environment variable for STARDOG_EXT as well as mount an additional volume containing the jars: docker run ... -e STARDOG_EXT=/var/opt/stardog-ext -v ~/stardog-ext:/var/opt/stardog-ext ...

    If the server starts up successfully, you should see something like the following in your terminal:

     ************************************************************
     This copy of Stardog is licensed to Somebody Awesome (somebody.awesome@stardog.com), Stardog
     This is a Enterprise license
     This license will expire in 355 days on Tue Oct 26 22:09:08 UTC 2021
     ************************************************************
    
                                                                 :;
                                         ;;                   `;`:
     `'+',    ::                        `++                    `;:`
     +###++,  ,#+                        `++                    .
     ##+.,',  '#+                         ++                     +
     ,##      ####++  ####+:   ##,++` .###+++   .####+    ####++++#
     `##+     ####+'  ##+#++   ###++``###'+++  `###'+++  ###`,++,:
     ####+    ##+        ++.  ##:   ###  `++  ###  `++` ##`  ++:
     ###++,  ##+        ++,  ##`   ##;  `++  ##:   ++; ##,  ++:
         ;+++  ##+    ####++,  ##`   ##:  `++  ##:   ++' ;##'#++
         ;++  ##+   ###  ++,  ##`   ##'  `++  ##;   ++:  ####+
     ,.   +++  ##+   ##:  ++,  ##`   ###  `++  ###  .++  '#;
     ,####++'  +##++ ###+#+++` ##`   :####+++  `####++'  ;####++`
     `####+;    ##++  ###+,++` ##`    ;###:++   `###+;   `###++++
                                                         ##   `++
                                                     .##   ;++
                                                         #####++`
                                                         `;;;.
     ************************************************************
    
    
     Stardog server 7.3.0 started on Thu Nov 05 21:42:54 UTC 2020.
    
     Stardog server is listening on all network interfaces.
     HTTP server available at http://localhost:5820.
    
     STARDOG_HOME=/var/opt/stardog/
    

Configuring Memory Settings

If needed, you can change the default JVM memory settings for Stardog by setting the STARDOG_SERVER_JAVA_ARGS environment variable like so:

docker run -v ~/stardog-home/:/var/opt/stardog -p 5820:5820 \
 -e STARDOG_SERVER_JAVA_ARGS="-Xmx8g -Xms8g -XX:MaxDirectMemorySize=12g" stardog/stardog

Configuring memory settings is discussed in greater detail in the Memory Usage section. It’s noted here for your reference if you are running Stardog via Docker.

Providing Options to the Server at Startup Time

As mentioned earlier, the server start command gets invoked when executing docker run. Often times, you may need to provide additional options to the server at startup time like enabling Stardog to accept SSL connections.

These additional options can be appended to the end of the docker run command like so:

docker run -it -v ~/stardog-home/:/var/opt/stardog -p 5820:5820 stardog/stardog --enable-ssl

Verifying the Signature

As of version 11.0.0, the Stardog image in Docker Hub is digitally signed by Stardog. Docker provides information about their Content Trust system in their online documentation here.

If you want to enforce that the image you use is digitally signed, set the environment variable DOCKER_CONTENT_TRUST to 1 before running docker pull (see more here).

If you want to verify the image on Docker Hub is digitally signed, you can run the command:

$ docker trust inspect stardog/stardog:latest --pretty

Signatures for stardog/stardog:latest

SIGNED TAG   DIGEST                                                             SIGNERS
latest       915070c7a72bba4bcae66789d21a59c33574f10eaed277eee57fc9ecdccf34c4   stardog

List of signers and their keys for stardog/stardog:latest

SIGNER    KEYS
stardog   3e6e217a9a9e

Administrative keys for stardog/stardog:latest

Repository Key:	1acd5f77de79aa54dbefd726caf47aecb39767b0342b27c677deb20ee09462d6
Root Key:	084fa0e02607008ff0e00ee4c29762bf0094a6a188c91de3d21dd8f7a71e5653

Note this is the signature for Stardog 11.0.0, and yours will look different if you’re using a more recent version.

What’s Next?

Get Started with Stardog Cloud, our complete Enterprise Knowledge Graph Platform, and connect to your running Stardog server. If you want to encrypt network traffic when using Stardog, see this guide for setting up SSL.

Check out our additional Getting Started Resources for some introductory blog posts, tutorials, video trainings and more.