Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
238 lines (183 sloc) 9.38 KB

JanusGraph Docker images

Build Status Docker pulls

This repository contains build scripts and configuration files for the official JanusGraph Docker images, which are published on the Docker Hub.


Start a JanusGraph Server instance

The default configuration uses the Oracle Berkeley DB Java Edition storage backend and the Apache Lucene indexing backend:

docker run --rm --name janusgraph-default janusgraph/janusgraph:latest

Connecting with Gremlin Console

Start a JanusGraph container and connect to the janusgraph server remotely using Gremlin Console:

$ docker run --rm --link janusgraph-default:janusgraph -e GREMLIN_REMOTE_HOSTS=janusgraph \
    -it janusgraph/janusgraph:latest ./bin/

         (o o)
plugin activated: janusgraph.imports
plugin activated: tinkerpop.server
plugin activated: tinkerpop.utilities
plugin activated: tinkerpop.hadoop
plugin activated: tinkerpop.spark
plugin activated: tinkerpop.tinkergraph
gremlin> :remote connect tinkerpop.server conf/remote.yaml
==>Configured janusgraph/
gremlin> :> g.addV('person').property('name', 'chris')
gremlin> :> g.V().values('name')

Using Docker Compose

Start a JanusGraph Server instance using docker-compose.yml:

docker-compose -f docker-compose.yml up

Start a JanusGraph container running Gremlin Console in the same network using docker-compose.yml:

docker-compose -f docker-compose.yml run --rm \
    -e GREMLIN_REMOTE_HOSTS=janusgraph janusgraph ./bin/


When the container is started it will execute files with the extension .groovy that are found in /docker-entrypoint-initdb.d with the Gremlin Console. These scripts are only executed after the JanusGraph Server instance was started. So, they can connect to it and execute Gremlin traversals.

For example, to add a vertex to the graph, create a file /docker-entrypoint-initdb.d/add-vertex.groovy with the following content:

g = traversal().withRemote('conf/')
g.addV('demigod').property('name', 'hercules').iterate()

Generate Config

JanusGraph-Docker has a single utility method. This method writes the JanusGraph Configuration and show the config afterward.

docker run --rm -it janusgraph/janusgraph:0.4.0 janusgraph show-config

Default config locations are /etc/opt/janusgraph/ and /etc/opt/janusgraph/gremlin-server.yaml.


The JanusGraph image provides multiple methods for configuration, including using environment variables to set options and using bind-mounted configuration.

Docker environment variables

The environment variables supported by the JanusGraph image are summarized below.

Variable Description
JANUS_PROPS_TEMPLATE JanusGraph properties file template (see below). The default properties file template is berkeleyje-lucene.
janusgraph.* Any JanusGraph configuration option to override in the template properties file, specified with an outer janusgraph namespace (e.g., See JanusGraph Configuration for available options.
gremlinserver.* Any Gremlin Server configuration option to override in the default configuration (YAML) file, specified with an outer gremlinserver namespace (e.g., gremlinserver.threadPoolWorker). See Gremlin Server Configuration for available options.
JANUS_SERVER_TIMEOUT Timeout (seconds) used when waiting for Gremlin Server before executing initialization scripts. Default value is 30 seconds.
JANUS_STORAGE_TIMEOUT Timeout (seconds) used when waiting for the storage backend before starting Gremlin Server. Default value is 60 seconds.
GREMLIN_REMOTE_HOSTS Optional hostname for external Gremlin Server instance. Enables a container running Gremlin Console to connect to a remote server using conf/remote.yaml.

Properties template

The JANUS_PROPS_TEMPLATE environment variable is used to define the base JanusGraph properties file. Values in the template properties file are used unless an alternate value for a given property is provided in the environment. The common usage will be to specify a template for the general environment (e.g., cassandra-es) and then provide additional individual configuration to override/extend the template. The available templates depend on the JanusGraph version (see conf/gremlin-server/janusgraph*.properties).

berkeleyje all
berkeleyje-es all
berkeleyje-lucene (default) all
cassandra-es all
cql-es >=0.2.1
Example: Berkeleyje-Lucene

Start a JanusGraph instance using the default berkeleyje-lucene template with custom storage and server settings:

docker run --name janusgraph-default \
    -e \
    -e gremlinserver.threadPoolWorker=2 \

Inspect the configuration:

$ docker exec janusgraph-default sh -c 'cat /etc/opt/janusgraph/ | grep ^[a-z]'

$ docker exec janusgraph-default grep threadPoolWorker /etc/opt/janusgraph/gremlin-server.yaml
threadPoolWorker: 2
Example: Cassandra-ES with Docker Compose

Start a JanusGraph instance with Cassandra and Elasticsearch using the cassandra-es template through docker-compose-cql-es.yml:

docker-compose -f docker-compose-cql-es.yml up

Inspect the configuration using docker-compose-cql-es.yml:

$ docker-compose -f docker-compose-cql-es.yml exec \
      janusgraph sh -c 'cat /etc/opt/janusgraph/ | grep ^[a-z]'
cache.db-cache = true
cache.db-cache-clean-wait = 20
cache.db-cache-time = 180000
cache.db-cache-size = 0.25

Mounted Configuration

By default, the container stores both the and gremlin-server.yaml files in the JANUS_CONFIG_DIR directory which maps to /etc/opt/janusgraph. When the container starts, it updates those files using the environment variable values. If you have a specific configuration and do not wish to use environment variables to configure JanusGraph, you can mount a directory containing your own version of those configuration files into the container through a bind mount, e.g., -v /local/path/on/host:/etc/opt/janusgraph:ro. You'll need to bind the files as read-only, however, if you do not wish to have the environment variables override the values in that file.

Example with mounted configuration

Start a JanusGraph instance with mounted configuration using docker-compose-mount.yml:

$ docker-compose -f docker-compose-mount.yml up
janusgraph-mount | chown: changing ownership of '/etc/opt/janusgraph/': Read-only file system


JanusGraph-Docker uses the same communication channels as JanusGraph in general. Please refer to the Community section in JanusGraph's main repository for more information about these various channels.

Please use GitHub issues only to report bugs or request features.


Please see in JanusGraph's main repository for more information, including CLAs and best practices for working with GitHub.


JanusGraph Docker images are provided under the Apache 2.0 license and documentation is provided under the CC-BY-4.0 license. For details about this dual-license structure, please see LICENSE.txt.

You can’t perform that action at this time.