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
    
    • 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

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.